默认情况下,CentOS 7上MySQL / MariaDB的存储位置在哪里?
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:
[root@bogon ~]# ps aux | grep mysqld mysql 1197 1.1 15.2 3744356 588116 ? Ssl 1月11 1:25 /usr/sbin/mysqld root 19215 0.0 0.0 112832 964 pts/0 S+ 01:19 0:00 grep --color=auto mysqld [root@bogon ~]#
Second, go to the mysqld process’ dir under /proc/
. For the above example,
其次,转到/proc/
下的mysqld进程的目录。 对于以上示例,
# cd /proc/1197/
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 1月 11 23:19 56 -> /var/lib/mysql/mysql/global_priv.MAI lrwx------. 1 mysql mysql 64 1月 11 23:19 57 -> /var/lib/mysql/mysql/global_priv.MAD lrwx------. 1 mysql mysql 64 1月 11 23:19 58 -> /var/lib/mysql/mysql/tables_priv.MAI lrwx------. 1 mysql mysql 64 1月 11 23:35 59 -> /var/lib/mysql/mysql/tables_priv.MAD
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/