zoukankan      html  css  js  c++  java
  • 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
        
        远程连接成功
    
  • 相关阅读:
    phpStudy for Linux (lnmp+lamp一键安装包)
    eq,neq,gt,lt等表达式缩写
    lnmp环境的使用
    lnmp环境的搭建
    箭头函数中的this
    Vue中实现路由懒加载及组件懒加载
    Vue项目中实现路由按需加载(路由懒加载)的3中方式:
    判断数据类型的方式以及各自的优缺点
    最近工作中踩的坑
    7种方法实现CSS左侧固定,右侧自适应布局
  • 原文地址:https://www.cnblogs.com/lz0925/p/12022737.html
Copyright © 2011-2022 走看看