Home  >  Article  >  Backend Development  >  How to Fix \"Access Denied for User \'Root\'@\'localhost\'\" Error in phpMyAdmin?

How to Fix \"Access Denied for User \'Root\'@\'localhost\'\" Error in phpMyAdmin?

Barbara Streisand
Barbara StreisandOriginal
2024-10-19 11:13:30273browse

How to Fix

How to Resolve "Access denied for user 'root'@'localhost'" Error in phpMyAdmin

If you encounter the "Access denied for user 'root'@'localhost' (using password: NO)" error while accessing phpMyAdmin, it often indicates that the password for the 'root' user has been incorrectly set or removed.

To fix this issue, follow these steps:

  1. Locate the config.inc file: Navigate to the following directory on your server: C:wampappsphpmyadmin[version number] (e.g., C:wampappsphpmyadmin3.5.1).
  2. Edit the config.inc file: Find the line: $cfg['Servers'][$i]['password'] = "";
  3. Set the root password: Replace the empty string with your desired root password. For example: $cfg['Servers'][$i]['password'] = 'rootpassword';
  4. Save and restart phpMyAdmin: Save the config.inc file and restart phpMyAdmin.

Once you have set the correct password, you should be able to access phpMyAdmin without receiving the "Access denied" error. Note that the root password must match the password set in the MySQL configuration file (usually my.ini or my.cnf).

If the above steps do not resolve the issue, you may need to consider other factors such as firewall settings, MySQL user permissions, or file permissions.

The above is the detailed content of How to Fix \"Access Denied for User \'Root\'@\'localhost\'\" 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