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/