mysql報錯unix:///var/mysql/mysql.sock

若是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 14php

查看mysql.sock的位置,通常處於
ls /var/mysql
ls /tmpmysql

默認位於 /var/mysqlsql

sudo vi /etc/php.inishell

這裏根據你的位置來設置,下面三處都要修改socket

pdo_mysql.default_socket=/tmp/mysql.sock
mysql.default_socket = /tmp/mysql.sock
mysqli.default_socket = /tmp/mysql.sock
相關文章
相關標籤/搜索