Where is the BASEDIR for MySQL installed with APT on Ubuntu?

Viewed 8028

According to the MySQL document, 2.10.1 Initializing the Data Directory:

  1. Change location into the top-level directory of your MySQL installation, represented here by BASEDIR:

    shell> cd BASEDIR

    BASEDIR is likely to be something like /usr/local/mysql or /usr/local. The following steps assume that you have changed location to this directory.

    You will find several files and subdirectories in the BASEDIR directory. The most important for installation purposes is the bin subdirectory, which contains the server as well as client and utility programs.

I've checked /usr/local/mysql and /usr/local, but neither of them contains anything related to MySQL. which mysql returns /usr/bin/mysql, but I don't think /usr/bin would be MySQL's base directory.

The document says I need to create a directory called mysql-files under BASEDIR, so I want to know where to find it.

4 Answers

The following will work in Ubuntu, any linux distro for that matter, OS X and pretty much any OS supporting mysql:

$ mysqladmin -u root variables | grep basedir

For some MySQL installation methods, data directory initialization is automatic For APT on Ubuntu - automatic initialization in /usr/bin/ it is basedir


/usr/bin/

mysql
mysqladmin
mysqldump
mysqlpump
mysqlshow
mysqlslap
mysqlcheck
mysqlbinlog
mysqld_safe
mysqlimport
mysqld_multi
mysqldumpslow
mysql_upgrade
mysql_config_editor
mysql_ssl_rsa_setup
mysql_tzinfo_to_sql
mysql_secure_installation

/usr/sbin/

mysqld

/usr/lib/mysql/

/plugin/

/private/

/var/lib/mysql/

it is datadir

/var/log/mysql/

error.log

/etc/mysql/mysql.conf.d/

mysqld.cnf

/var/lib/mysql-files/


/var/lib/mysql-keyring/


/etc/systemd/system/multi-user.target.wants/

mysql.service

/home/name_account_pc

.mysql_history
Related