> 文章列表 > 关于Warning: World-writable config file ‘/etc/mysql/my.cnf‘ is ignored

关于Warning: World-writable config file ‘/etc/mysql/my.cnf‘ is ignored

关于Warning: World-writable config file ‘/etc/mysql/my.cnf‘ is ignored

不知道那个大兄弟,更改了my.cnf的权限为 0777

登陆mysqll的时候提示:Warning: World-writable config file '/etc/mysql/my.cnf' is ignored

里面的配置被忽略了, my.cnf不起作用

如果不是安装在docker里面的话,直接 chmod  0644 /etc/mysql/my.cnf  重启db即可,如果还提示有xxx被忽略了,继续改对应的配置文件权限为0644 。

我这边的数据库mariadb 是装在docker里面的,mariadb跟mysql有一点点不一样,

ls -l  提示my.cnf是一个软连接,再ls -l /etc/alternatives/my.cnf 又是一个软连接,最终兜个圈,就是mariadb.cnf  ,然后更改 chmod  0644 /etc/mysql/mariadb.cnf,重启mysql ,提示很多配置被忽略了,/etc/mysql/mariadb.conf.d/50-client.cnf,50-mysql-clients.cnf ,50-mysqld_safe.cnf 50-server.cnf 60-galera.cnf 这些配置都被忽略了,然后ls -l /etc/mysql/mariadb.conf.d 发现权限也不是644,然后继续改一下权限:chmod  0644 /etc/mysql/mariadb.conf.d/*.conf  然后重启数据库,就可以了。

# cd /etc/mysql && ls -l 
-rw-r--r-- 1 root root    0 Apr  6 01:58 1
drwxrwxr-x 3 root root   96 Apr  6 01:42 conf.d
-rwxr-xr-x 1 root root 1731 Nov  5  2021 debian-start
-rw------- 1 root root  546 Nov 10  2021 debian.cnf
-rwxrwxrwx 1 root root 1172 Nov 10  2021 mariadb.cnf
drwxr-xr-x 3 root root 4096 Nov 10  2021 mariadb.conf.d
lrwxrwxrwx 1 root root   24 Nov 10  2021 my.cnf -> /etc/alternatives/my.cnf

# ls -l /etc/alternatives/my.cnf
lrwxrwxrwx 1 root root 22 Nov 10  2021 /etc/alternatives/my.cnf -> /etc/mysql/mariadb.cnf