欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

Can't connect to local MySQL server through socket....

程序员文章站 2022-03-08 13:29:57
...

安装Discuz!3.2 初始化数据库阶段报错,Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) ,如图:
Can't connect to local MySQL server through socket....

我已经检查应该检查的配置,特么的发现都没有问题,郁闷...
1.服务器端mysql服务启动一切正常
Can't connect to local MySQL server through socket....
2.文件权限也没有问题
Can't connect to local MySQL server through socket....
3.使用mysql client命令也可以正常连接,和执行sql
Can't connect to local MySQL server through socket....

各位看看还有可能是哪儿出现了问题呢

回复内容:

安装Discuz!3.2 初始化数据库阶段报错,Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) ,如图:
Can't connect to local MySQL server through socket....

我已经检查应该检查的配置,特么的发现都没有问题,郁闷...
1.服务器端mysql服务启动一切正常
Can't connect to local MySQL server through socket....
2.文件权限也没有问题
Can't connect to local MySQL server through socket....
3.使用mysql client命令也可以正常连接,和执行sql
Can't connect to local MySQL server through socket....

各位看看还有可能是哪儿出现了问题呢

host如果使用的是localhost会使用socket连接,可以改成127.0.0.1试试

试试:mysql -uroot -p -S /var/lib/mysql/mysql.sock
看一下配置里[client]有没有设置sock

我记得遇到过这个问题,你试试这个方法
Can't connect to local MySQL server through socket '/tmp/mysql.sock'

相关标签: php mysql