简体   繁体   English

PHP警告mysql_connect

[英]php warning mysql_connect

I am having problem while connecting php with mysql. 在将php与mysql连接时出现问题。 Mysql server and client is running fine.And mysql socket file is in mysql服务器和客户端运行良好,并且mysql套接字文件在

/var/mysql/mysql.sock

But while connecting like : 但是在连接时像:

$con = mysql_connect("localhost","root","pass");

It says 它说

Socket operation on non-socket (trying to connect via unix:///var/mysql/mysql.sock)

Any clue? 有什么线索吗?

采用

$con = mysql_connect("127.0.0.1","","");

It sounds like your actual MySQL Socket File is in a different location than where PHP is expecting it to be. 听起来您的实际MySQL套接字文件位于与PHP期望位置不同的位置。

Do a phpinfo(); 做一个phpinfo(); and see what the location of the socket file should be, per PHP. 并查看每个PHP套接字文件的位置。

You can then symlink it from where it is currently located. 然后,您可以从当前位置对其进行符号链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM