Understanding MySQL Database Directory

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.