Where is MySQL / MariaDB storage location by default on CentOS 7?

Where is MySQL / MariaDB storage location by default on CentOS 7? No special configuration to the MariaDB from official repository of CentOS.

asked Aug 17 by anonymous

1 Answer

On CentOS 7 Linux it is usually by default

/var/lib/mysql

But here I give you another "hacky" way to find it out.

The method is to find out the mysql daemon mysqld' opened files and the paths because it must open the files to read/write data.

First, find out the process ID of the mysqld process:

# ps aux | grep mysqld

mysql    25403  1.0 17.2 1322220 174948 ?      Ssl  Aug31 178:10 /usr/sbin/mysqld

Second, go to the mysqld process' dir under /proc/. For the above example,

# cd /proc/25403/

Check the opened files under the directory fd:

# ls fd -lha

An example is as follows for some files:

lrwx------. 1 mysql mysql 64 Sep 12 11:43 83 -> /var/lib/mysql/my_wp2/wp_links.MYI
lrwx------. 1 mysql mysql 64 Sep 12 11:43 84 -> /var/lib/mysql/my_wp2/wp_links.MYD

You get the path for the directory to storing the database data files.

answered Sep 12 by Eric Z Ma (43,600 points)

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...