Home >Backend Development >PHP Tutorial >Can't connect to local MySQL server through socket....

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

WBOY
WBOYOriginal
2016-06-06 20:09:091402browse

安装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'

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn