#2002 occurred yesterday when using phpmyadmin to connect to mysql - the server did not respond (or the socket of the local MySQL server was not configured correctly), but I had no problem using php to connect as
The code is as follows
代码如下 |
复制代码 |
$link=mysql_connect("127.0.0.1","root","password");
if (!$link) echo "connect error";
else echo "connect ok";
?>
|
|
Copy code
|
$link=mysql_connect("127.0.0.1","root","password");
if (!$link) echo "connect error";
else echo "connect ok";
?>
Later I thought that the address of the MySQL database server should be changed to 127.0.0.1,
代码如下 |
复制代码 |
$cfg['Servers'][$i]['host'] = 'localhost';
改成
$cfg['Servers'][$i]['host'] = '127.0.0.1';
|
Specific method:
| Open the config.inc.php we just copied to the phpMyAdmin directory
Find this sentence:
The code is as follows
|
Copy code
$cfg['Servers'][$i]['host'] = 'localhost';
changed to
$cfg['Servers'][$i]['host'] = '127.0.0.1';
That’s it. I think the cause of this problem is that there is a problem with the host file parsing. It should be solved by everyone.
http://www.bkjia.com/PHPjc/630736.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/630736.htmlTechArticleYesterday when using phpmyadmin to connect to mysql, #2002 server did not respond (or the socket of the local MySQL server did not Correctly configured), but I have no problem using php to connect as the code is...
|
|