默认情况下,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.

您将获得用于存储数据库数据文件的目录的路径。

Answered by Eric Z Ma.
埃里克·马(Eric Z Ma)回答。

翻译自: https://www.systutorials.com/where-is-mysql-mariadb-storage-location-by-default-on-centos-7/

posted @   老虎死了还有狼  阅读(968)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· Blazor Hybrid适配到HarmonyOS系统
· Obsidian + DeepSeek:免费 AI 助力你的知识管理,让你的笔记飞起来!
· 分享4款.NET开源、免费、实用的商城系统
· 解决跨域问题的这6种方案,真香!
· 一套基于 Material Design 规范实现的 Blazor 和 Razor 通用组件库
历史上的今天:
2020-01-11 zabbix功能应用
2020-01-11 关于对生成器对象的理解
点击右上角即可分享
微信分享提示