原因是/var/lib/mysql 的访问权限问题。
修改/etc/my.conf:
[mysqld]
datadir=/usr/local/mysql/data
socket=/var/lib/mysql/mysql.sock
[mysql.server]
user=mysql
basedir=/usr/local/mysql
If there is not currently a section called [client], add one at the bottom of the file and copy the socket= line under the [mysqld] section such as:
[client]
socket=/var/lib/mysql/mysql.sock
运行/usr/local/mysql/bin/mysqld_safe
您好,
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (
修改完mysql的配置文件/etc/my.cnf的datadir之后发现如此错误,排查寻找解决方法
改datadir记得同步修改socket后的地址
首先查看mysql的错误提示和
systemctl status mysqld.service看不出来错误继续
journalctl -xe发现是权限不足
chown -R mysql:mysql /vdb1/lib/去对应的目录下查看mysql.sock是否存在,如果不存在重启机器,reboot
再次启动mysql 成功
---------------------
作者:dongsir 董先生
来源:CSDN
原文:https://blog.csdn.net/qq6759/article/details/85335026
版权声明:本文为博主原创文章,转载请附上博文链接!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)