未从 my.cnf 加载 Mariadb 配置

Mariadb configuration is not loaded from my.cnf

我在 my.cnf 中的 mariadb 配置没有为 "log-error""pid-file" 加载。我检查了其他配置参数是否已加载。

[root@kvm10 ~]# cat /etc/my.cnf
[mysqld]
!includedir /etc/mysqld/conf.d
datadir=/mnt/mgmt/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
tmpdir=/mnt/mgmt/var/lib/mysql_tmp
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
### TRT-3229 #####
sync_binlog=1
innodb_flush_method=O_DIRECT
innodb_support_xa = 1
myisam_repair_threads = 2
myisam_recover_options = FORCE
###################
innodb_file_per_table=1
innodb_log_buffer_size = 8M
table_open_cache=256
max_heap_table_size=256M
### TRT-4685 ###
max_connections=500
################
innodb_log_file_size = 512M

[mysqld_safe]
log-error=/var/log/mariadb/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@kvm10 ~]# 

但是 log-errorpid-file 的配置值未被 MariaDB 选择。

[root@kvm10 ~]# mysql -e "show variables like 'pid_file'"
+---------------+-----------------------------------+
| Variable_name | Value                             |
+---------------+-----------------------------------+
| pid_file      | /mnt/mgmt/var/lib/mysql/kvm10.pid |
+---------------+-----------------------------------+
[root@kvm10 ~]# mysql -e "show variables like 'log_error'"
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_error     |       |
+---------------+-------+
[root@kvm10 ~]# 

我是漏掉了什么东西还是犯了错误。我检查了 /var/log/mariadb/mysqld.log & /var/run/mysqld/mysqld.pid 中的文件权限。

如果您通过 运行ning mysqld_safe 直接或通过旧式初始化脚本(MariaDB 5.5/10.0 或更早版本)启动服务器,则应该从配置文件中选择这些选项Linux 分布)。如果您有支持 systemd 的 MariaDB 10.1+ 和 Linux 发行版并通过该服务启动 MariaDB 服务器,则不会使用 mysqld_safe

它们可能不起作用的另一个原因是,如果您在没有 --defaults-file 选项的情况下启动 mysqld_safe,并且在默认位置的其他地方有另一个配置文件会覆盖这些选项。

1) 将选项添加到配置文件的 [mysqld] 部分,重新​​启动服务器并查看是否有帮助。

如果没有帮助,

2a) 如果您通过 systemd 服务 运行 MariaDB 服务器,请检查服务配置,也许里面有东西;

2b) 如果您通过 mysqld_safe 运行 MariaDB 服务器,请尝试使用 --defaults-file=/etc/my.cnf 启动它,以确保仅使用此配置文件。