PHP连接MYSQL 报错"No such file or directory"
2014-11-28 11:41
495 查看
首先确定是
写个phpinfo页面,找到
启动mysql(见说明2),执行命令 STATUS; 记下UNIX socket的值。
如果2和3的值不一样,则打开php.ini(可以从phpinfo页面中找到php.ini的位置,默认是
(注意,一共修改三处,分别为:
重启apache。
OK,到这里错误就排除了。
mysql_connect()和
mysql_pconnect()的问题,故障现象就是函数返回空,而
mysql_error()返回“No such file or directory”。
写个phpinfo页面,找到
mysql.default_socket、
mysqli.default_socket、
pdo_mysql.default_socket。
启动mysql(见说明2),执行命令 STATUS; 记下UNIX socket的值。
如果2和3的值不一样,则打开php.ini(可以从phpinfo页面中找到php.ini的位置,默认是
/private/etc/php.ini),将2中提到的三个配置项的值改成3的值。
(注意,一共修改三处,分别为:
mysql.default_socket、
mysqli.default_socket、
pdo_mysql.default_socket)
重启apache。
OK,到这里错误就排除了。
相关文章推荐
- PHP连接MySQL的时候报错SQLSTATE[HY000] [2002] No such file or directory
- php连接mysql时报错:SQLSTATE[HY000] [2002] No such file or directory
- SQLSTATE[HY000] [2002] No such file or directory php连接mysql失败
- linux php添加mysql扩展时报错: No such file or directory #include "ext/mysqlnd.h"
- PHP连接MySQL的时候报错SQLSTATE[HY000] [2002] No such file or directory
- php连接mysql时报错:SQLSTATE[HY000] [2002] No such file or directory
- 解决MAC下PHP连接MYSQL错误Warning: mysql_connect(): No such file or directory in conn.php
- 解决MAC下PHP连接MYSQL错误Warning: mysql_connect(): No such file or directory in conn.php
- PHP连接MySQL的时候报错SQLSTATE[HY000] [2002] No such file or directory
- PHP连接MySQL的时候报错SQLSTATE[HY000] [2002] No such file or directory
- PHP错误mysql_connect(): No such file or directory解决方法
- Mac下PHP连接MySQL报错"No such file or directory"的解决办法
- can't exec "mysql_config":no such file or directory at Makefile.PL line 76
- python3.5连接MySQL出现Cannot open include file: 'config-win.h': No such file or directory 错误解决办法
- mac 连接mysql提示 Warning: mysqli::real_connect(): (HY000/2002): No such file or directory
- mysql_connect提示"No such file or directory"错误"
- PHP连接MySql报SQLSTATE[HY000] [2002] No such file or directory
- Mac下PHP连接MySQL报错"No such file or directory"的解决办法
- mysql,mysqli,pdo方式连接数据库[no such file or directory]
- php服务器出现CodeIgniter错误mysql_connect(): No such file or directory解决方法