How to solve the problem of "#2002 Unable to log in to MySQL server" when logging in to phpMyAdmin

888u

Last update at :2024-06-19,Edit by888u

Generally, when we manage the Linux VPS server website database, most of us will use the PHPMYADMIN panel to visually manage the database. In the evening, a netizen informed me that PHPMYADMIN, which was originally able to log in, could not log in today, but the website operation was normal. When logging in to PHPMYADMIN, a red "#2002 Unable to log in to the MySQL server" error message appeared. Make sure there is no problem with the password and user. of.

It doesn’t matter if there is a problem, let’s find and search for a solution. The most direct method is as follows:

First, traverse to the directory where the PHPMYADMIN folder is located in our current website environment

Second, find the config.default.php file

Third, replacement and exchange:

$cfg[\\’Servers\\’][$i][\\’host\\’] = \\’localhost\\’;

Replace with

$cfg[\\’Servers\\’][$i][\\’host\\’] = \\’127.0.0.1\\’;

Fourth, save and replace the file in the server, restart MYSQL to take effect, you can do it without restarting.

Finally, we can log in normally by logging in to PHPMYADMIN. There is a problem that needs to be noted here. When we installed the website, we configured the server link to LOCALHOST. In the future, we need to use 127.0.0.1 as the server link.

Recommended site searches: foreign vps server rental, US anti-attack server, registered domain name, vps for IP, US unlimited content hosting, Hong Kong hosting, ftp space, domain name price, vps US server, European server and US server, < /p>

How to solve the problem of

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码