Home >Backend Development >PHP Tutorial >When phpmyadmin connects to mysql, 2002 server is not responding_PHP tutorial

When phpmyadmin connects to mysql, 2002 server is not responding_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:06:03939browse

#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

Open the config.inc.php we just copied to the phpMyAdmin directory
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:

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...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn