如果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