Some friends will get the No such file or directory error message when using mysql connection. Let me summarize the solutions below.
Connection code
The code is as follows
|
Copy code
|
||||
$this->linkid = @mysql_pconnect($host, $user, $password) or die(mysql_error());
Make a phpinfo() page. Look for ‘mysql.default_socket‘, ‘mysqli.default_socket‘, and ‘pdo_mysql.default_socket‘. Remember their value; this is where PHP is trying to connect to MySQL.
1. First of all, it is determined that it is a problem with mysql_connect() and mysql_pconnect(). The fault phenomenon is that the function returns empty and mysql_error() returns "No |
2. Write a phpinfo page and find mysql.default_socket, mysqli.default_socket, and pdo_mysql.default_socket.
, change the values of the three configuration items mentioned in 2 to the values of 3.
http: //www.bkjia.com/PHPjc/632137.html