当前位置:Gxlcms > mysql > mysql报错unix:///var/mysql/mysql.sock_MySQL

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

时间:2021-07-01 10:21:17 帮助过:20人阅读

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

人气教程排行