Generally, when we manage the website database of the Linux VPS server, most of us use the PHP MYADMIN panel to visually manage the database. In the evening, a netizen told that PHPMYADMIN, which could have logged in, could not log in today, but the website operation was normal, and red appeared when logging in to PHPMYADMIN“ #2002 Unable to log in to MySQL server "You can confirm the password and user without any problem.
It doesn't matter if there is a problem. Let's find and search for solutions. The most direct way 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 to PHPMYADMIN again, and we need to pay attention to one problem here. When we install the website, we configure the server link to be LOCALHOST, and later we need to use 127.0.0.1 as the server link.