<?php
$conn = mysql_connect('localhost', 'USER', 'PASSWORD');
if(!$conn) {
echo 'Error: ' . mysql_errno() . ' - ' . mysql_error();
}
?>
使用 "127.0.0.1" 代替 "localhost" 来连接MySQL问题解决
参考资料:
PHP - MySQL connection not working: 2002 No such file or directory:https://stackoverflow.com/questions/1676688/php-mysql-connection-not-working-2002-no-such-file-or-directory
0 条评论。