>백엔드 개발 >PHP 튜토리얼 >Can't connect to local MySQL server through socket....

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

WBOY
WBOY원래의
2016-06-06 20:09:091402검색

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

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.