Home > Database > Mysql Tutorial > Why am I getting a \'#2002 cannot log in to the mysql server phpmyadmin\' error after setting up phpMyAdmin?

Why am I getting a \'#2002 cannot log in to the mysql server phpmyadmin\' error after setting up phpMyAdmin?

Patricia Arquette
Release: 2024-10-29 16:38:02
Original
939 people have browsed it

Why am I getting a

Troubleshooting #2002 Login Error in phpMyAdmin

Problem:
Users may encounter the "#2002 cannot log in to the mysql server phpmyadmin" error when attempting to access phpMyAdmin after setup.

Solution:

This error can occur when the host setting in phpMyAdmin's config file (config.inc.php) is incorrect. To resolve this issue:

Step 1: Locate config.inc.php

  • Navigate to the phpMyAdmin root directory after unraring.
  • If config.inc.php does not exist, rename or copy config.sample.inc.php and rename it to config.inc.php.

Step 2: Edit config.inc.php

  • Open config.inc.php in a text editor.
  • Locate the following line:

    <code class="php">$cfg['Servers'][$i]['host'] = 'localhost';</code>
    Copy after login
  • Replace 'localhost' with '127.0.0.1':

    <code class="php">$cfg['Servers'][$i]['host'] = '127.0.0.1';</code>
    Copy after login

Step 3: Save and Refresh

  • Save your changes to config.inc.php.
  • Refresh the phpMyAdmin login page.

Additional Notes:

  • Host value: In most cases, '127.0.0.1' should be used as the host value, representing the local machine where MySQL server is running.
  • Fresh Install: If config.inc.php does not exist, ensure to copy config.sample.inc.php and change the host value before proceeding.

The above is the detailed content of Why am I getting a \'#2002 cannot log in to the mysql server phpmyadmin\' error after setting up phpMyAdmin?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template