Home >Database >Mysql Tutorial >mysql报错unix:///var/mysql/mysql.sock_MySQL

mysql报错unix:///var/mysql/mysql.sock_MySQL

WBOY
WBOYOriginal
2016-06-01 13:48:151264browse

bitsCN.com

如果mysql连接出现 


Warning: mysqli_connect() [function.mysqli-connect]: [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) in xxx.php on line 14

 

查看mysql.sock的位置,一般处于
ls /var/mysql
ls /tmp

默认位于 /var/mysql

sudo vi /etc/php.ini

这里根据你的位置来设置,下面三处都要修改

 

1 pdo_mysql.default_socket=/tmp/mysql.sock 2 mysql.default_socket = /tmp/mysql.sock 3 mysqli.default_socket = /tmp/mysql.sock bitsCN.com
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