• 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
        
        远程连接成功
    
  • 相关阅读:
    169_Majority Element
    171_Excel Sheet Column Number
    217_Contains Duplicate
    242_Valid Anagram
    【findIndex】根据数组对象某一元素的id,找到此元素在数组所在的位置
    【鼠标右击组件】v-contextmenu
    【 拖拽组件】基于 Sortable.js 的 Vue 拖拽组件。 访问地址:Vue.Draggable
    【vue-markdown编辑器】vue-markdown 组件github地址
    mac下如何制作windows启动盘
    【vue webstorm】WebStorm Vue代码格式错误
  • 原文地址:https://www.cnblogs.com/lz0925/p/12022737.html
Copyright © 2020-2023  润新知