MySQL无法启动问题解决Warning: World-writable config file ‘/etc/my.cnf’ is ignored

原文:MySQL无法启动问题解决Warning: World-writable config file ‘/etc/my.cnf’ is ignored

  • 今天重启一台内网服务器,发现mysql无法正常重启,执行systemctl start mysql,报错如下
    Starting LSB: start and stop MySQL...
    Dec 11 14:24:42 localhost.localdomain mysql[32329]: my_print_defaults: [Warning] World-writable config file ‘/etc/my.cnf‘ is ignored.
    Dec 11 14:24:42 localhost.localdomain mysql[32329]: Starting MySQL.my_print_defaults: [Warning] World-writable config file ‘/etc/my.cnf‘ is ignored.
    Dec 11 14:24:42 localhost.localdomain mysql[32329]: my_print_defaults: [Warning] World-writable config file ‘/etc/my.cnf‘ is ignored.
    Dec 11 14:24:42 localhost.localdomain mysql[32329]: Logging to ‘/usr/local/mysql/data/localhost.localdomain.err‘.
    Dec 11 14:24:43 localhost.localdomain mysql[32329]: ERROR! The server quit without updating PID file (/usr/local/mysql/data/localhost.localdomain.pid).
    Dec 11 14:24:43 localhost.localdomain systemd[1]: mysql.service: control process exited, code=exited status=1

  • 刚开始关注点放在了 ERROR! The server quit without updating PID file (/usr/local/mysql/data/localhost.localdomain.pid). 这里,发现mysql下没有data这个文件夹,以为数据库文件丢失了呢,头疼。

  • 后来将关注点放到 my_print_defaults: [Warning] World-writable config file ‘/etc/my.cnf‘ is ignored.

    • 查看my.cnf的权限,
    • ls -l /etc/my.cnf
    • -rwxrwxrwx 1 root root 1404 Oct 16 19:31 /etc/my.cnf , 发现是777权限
    • chmod 644 /etc/my.cnf , 设置为644权限
    • systemctl start mysql , 一切OK
  • 另外,发现无法远程连接,之前设置过IP,用户访问权限,但还是重新设置了一遍,并开放端口3306,才可以远程连接(由于设置权限和开放端口没有分开执行,所以并未确定是端口还是权限造成的)。

    GRANT ALL PRIVILEGES ON *.* TO ‘username ‘@‘%‘ IDENTIFIED BY ‘password‘ WITH GRANT OPTION;

    FLUSH   PRIVILEGES;

    iptables -I INPUT -p tcp --dport 3306-j ACCEPT
    
    远程连接成功

MySQL无法启动问题解决Warning: World-writable config file ‘/etc/my.cnf’ is ignored

上一篇:SQL Server 2012从零开始学 (王英英,张少军) 高清PDF扫描版[188M]下载


下一篇:Python面向对象编程、类