Home >Backend Development >PHP Tutorial >How to Fix \'Access Denied\' Error When Connecting to MySQL via phpMyAdmin?

How to Fix \'Access Denied\' Error When Connecting to MySQL via phpMyAdmin?

Patricia Arquette
Patricia ArquetteOriginal
2024-10-19 11:47:29252browse

How to Fix

Troubleshooting Access Denied Error in phpMyAdmin

Problem:

When attempting to access phpMyAdmin through localhost/phpmyadmin/, users may encounter an "Access denied" error for the root user with localhost as the host. The error indicates that the connection to the MySQL server was rejected due to an incorrect host, username, or password.

Solution:

To resolve this issue without reinstalling WAMP, follow these steps:

  1. Locate the config.inc file, typically found under C:wampappsphpmyadmin3.5.1.
  2. Search for the following line:

    <code class="php">$cfg['Servers'][$i]['password'] =";</code>
  3. Replace the empty string with your desired root password:

    <code class="php">$cfg['Servers'][$i]['password'] = 'Type your root password here';</code>
  4. Save and close the config.inc file.

Restart phpMyAdmin and try accessing it through localhost/phpmyadmin/. The "Access denied" error should now be resolved.

The above is the detailed content of How to Fix \'Access Denied\' Error When Connecting to MySQL via 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