Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2 &qu

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2 "没有那个文件或目录")

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2 &qu

  • 找到 /etc/mysql/mariadb.conf.d/看看client中的socket=啥

  • 我的是socket = /var/run/mysqld/mysqld.sock

  • 所以我修改的软链接是

sudo ln -s /var/run/mysqld/mysqld.sock /var/lib/mysql/mysql.sock

  • 一定要根据etc下的配置文件去找sock,我看了好几篇博文,发现都不一样还有的在tmp下

  • mysql mariadb都是适用,不过具体名字的可能不一样,后缀是一样的

  • 重启

service mysql restart

上一篇:vb.net 有符号16进制转10进制


下一篇:IO多路复用技术总结