Where is MySQL / MariaDB storage location by default on CentOS 7? No special configuration to the MariaDB from official repository of CentOS.
默认情况下,CentOS 7上MySQL / MariaDB的存储位置在哪里? 从CentOS的官方存储库对MariaDB无需特殊配置。
On CentOS 7 Linux it is usually by default
在CentOS 7 Linux上 ,通常默认情况下
/var/lib/mysql
But here I give you another “hacky” way to find it out.
但是在这里,我为您提供了另一种“ hacky”方法来发现它。
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.
该方法是找出mysql守护程序mysqld'打开的文件和路径,因为它必须打开文件才能读取/写入数据。
First, find out the process ID of the mysqld process:
首先,找出mysqld进程的进程ID:
# 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,
其次,转到/proc/
下的mysqld进程的目录。 对于以上示例,
# cd /proc/25403/
Check the opened files under the directory fd:
检查目录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.
您将获得用于存储数据库数据文件的目录的路径。
翻译自: https://www.systutorials.com/where-is-mysql-mariadb-storage-location-by-default-on-centos-7/