Home >Database >Mysql Tutorial >How to Fix the \'Cannot Log In to the MySQL Server\' Error in phpMyAdmin?
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!