Tag Archives: Warning: Worldwritable config file ‘/etc/my.cnf’ is ignored

[Solved] Warning: World-writable config file ‘/etc/my.cnf’ is ignored

Today, use the shell to log in to MySQL directly, and the error is as follows

liup@ubuntu :~$ mysql
Warning: World-writable config file ‘/etc/mysql/my. cnf’ is ignored
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

‘/etc/my.cnf’ is ignored, which probably means that the permissions are globally writable and any user can write. mysql is worried about such files being maliciously modified by other users, so it ignores this configuration file. This makes it inaccessible, which is one of mysql’s security mechanisms. So we have to change some permissions. Set other users not writeable.

The shell is as follows

chmod 644 /etc/my.cnf

Then execute:

service mysql restart