The database directory is where the MySQL database server holds the data files, not only the files on the tables, but also the data files and MySQL server options files. Different distributions, the default location of the database directory is different.
Location of the Data directory
The default database location
The location of the default database is compiled in the server.
If you are installing MySQL in a source distribution package, the typical default location may be/usr/local/var;
/usr/local/mysql/data if MySQL is installed in the binary distribution package;
Installed in the RPM file for/var/lib/mysql.
For distribution on the WINDWOS platform, its location is Basedir\data
The location of the data directory can be specified explicitly by--datadir =/Path/to/dir When starting the server. This option is useful if you want to place the data directory somewhere other than the default location.
Understanding the location of the database directory
As a MySQL administrator, you should know where the data directory is. If you are running multiple servers, you should have the location of all the data directories. However, if you do not know the location of the directory (perhaps you are replacing the previous administrator and he left a bad record), there are several ways to find it:
1, can use the mysqladmin variable directly from the server to get the data directory path name. In UNIX, the output is similar to the following:
$mysqladmin variables
+-------------------------+---------------------------
| variable_name | Value
+-------------------------+---------------------------
| Ansi_mode | Off
| Back_log | 50
| Basedir | /var/local
| Connect_timeout | 5
| Concurrent_insert | On
| DataDir | /usr/local/var