Home >Database >Mysql Tutorial >How to Fix the \'Cannot Log In to the MySQL Server\' Error in phpMyAdmin?

How to Fix the \'Cannot Log In to the MySQL Server\' Error in phpMyAdmin?

DDD
DDDOriginal
2024-10-30 00:53:031031browse

How to Fix the

phpMyAdmin Login Error: #2002 Cannot Log In to the MySQL Server

When trying to log in to phpMyAdmin, users may encounter the error message "#2002 cannot log in to the mysql server phpmyadmin," particularly during installation. This issue arises due to an incorrect host address configured in phpmyadmin/config.inc.php.

To resolve this error, edit the config.inc.php file and modify the following line:

$cfg['Servers'][$i]['host'] = 'localhost';

Replace "localhost" with the IP address of your MySQL server. For a local machine, this will typically be "127.0.0.1."

$cfg['Servers'][$i]['host'] = '127.0.0.1';

After making this change, restart your web server or reload your browser. This should allow you to log in to phpMyAdmin successfully.

If config.inc.php doesn't exist during a fresh install, create it by renaming (or copying) config.sample.inc.php and changing the host address accordingly.

The above is the detailed content of How to Fix the \'Cannot Log In to the MySQL Server\' Error in phpMyAdmin?. For more information, please follow other related articles on the PHP Chinese website!

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