Home >Database >Mysql Tutorial >Can't connect to local MySQL server through sock_MySQL

Can't connect to local MySQL server through sock_MySQL

WBOY
WBOYOriginal
2016-06-01 13:08:42887browse

Error信息

ERROR - 2014-06-07 11:53:33 --> 2002 - SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) in /var/www/html/blog/fuel/core/classes/database/pdo/connection.php on line 100

本人服务器的现象是:

mysql可以正常启动,命令执行也没有任何问题

但是还是会出现上面的错误

原因:

经过调查,是因为/var/lib/mysql/mysql.sock 这个文件的权限有问题
解决办法:
chmod 777 /var/lib/mysql/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