Warning: World-writable config file ‘/etc/my.cnf.d/mysql-clients.cnf’ is ignored

Warning: World-writable config file ‘/etc/my.cnf.d/mysql-clients.cnf’ is ignored

Friday, September 6, 2019

2:33 PM

mysql Login 时无法直接用密码进入,需要回后再次输入密码才能进入数据库。

Warning: World-writable config file /my.cnf.d/mysql-clients.cnf’ is ignored

查看提示中的配置文件权限

[root@localhost mysql_bak]# ls -al /etc/my.cnf.d/*

-rw-r–r–. 1 root root 295 Apr 30 2017 /etc/my.cnf.d/client.cnf

-rwxrwxrwx. 1 root root 232 Apr 30 2017 /etc/my.cnf.d/mysql-clients.cnf

-rw-r–r–. 1 root root 744 Apr 30 2017 /etc/my.cnf.d/server.cnf

权限777,任何一个用户都可以改mysql-clients.cnf,mysql 设为存在很大的安全隐患.

我们需要对其权限进行修改, 将些文件的权限由 777 改为 644

chmod 644 /etc/my.cnf.d/mysql-clients.cnf

更改权限后, 重启mariadb 数据库, systemctl restart mariadb.service

再次测试警告消,直接进入数据库。 注 -p 后面直接输入密码,无需空格。

格式为:

Mysql -u user -pPassword

Leave a Comment