错误信息显示:
Warning: mysql_connect()
[function.mysql-connect]: Can't connect to local MySQL
server through socket '/tmp/mysql.sock' (2) in
/www/conn.php on line 6
mysql 安装在/usr/local/mysql
php 安装在/usr/local/php
apache2 安装在/usr/local/apache
用netstat -l |grep mysql 查看mysql.sock是在哪个目录。
我查看是/tmp/mysql/mysql.sock
修改/etc/my.cnf 将sock=/tmp/mysql/mysql.sock 改成/tmp/mysql.sock 。
重新启动mysql,apache ..可以正常联接
阅读(1047) | 评论(0) | 转发(0) |