ERROR 2002 (HY000): Can't connect to local MySQL server through socket 'varlibmysq.sock' (2)

    xiaoxiao2022-07-03  151

    环境:centos7.3安装mysql5.6 使用mysql -u root报ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysq.sock’ (2) 打开mysql的日志:(/var/log/mysqld.log)看到了[ERROR] /usr/sbin/mysqld: unknown variable ‘default-character-set=utf8’。解决方法: 1.先删除 rm -rf /var/lib/mysql/, (重启mysql后会重新生成/var/lib/mysql和/var/lib/mysql/mysqld.sock) 2.打开 vim /etc/my.cnf。 将default-character-set=utf8 改为 character_set_server=utf8 3 .重启系统 参考的资料:https://www.cnblogs.com/felove2013/p/6293710.html。 (遇到bug,一定要看日志,这样才能快速的找到问题的根源。)
    最新回复(0)