Home  >  Article  >  Database  >  Why Does MySQL Reject Access for User \'root\'@\'localhost\' with \"Access Denied\" Error?

Why Does MySQL Reject Access for User \'root\'@\'localhost\' with \"Access Denied\" Error?

Susan Sarandon
Susan SarandonOriginal
2024-11-03 18:48:03543browse

Why Does MySQL Reject Access for User 'root'@'localhost' with

Troubleshooting MySQL Access Denied for User 'root'@'localhost'

When attempting to run XAMPP, users may encounter the error message "MySQL said: Documentation #1045 - Access denied for user 'root'@'localhost' (using password: NO)." This error indicates that MySQL is rejecting the connection attempt due to invalid credentials or server configuration issues.

In this case, the user has verified that a password is not set in the config.inc.php file. However, the solution lies in manually editing the file.

Solution:

  1. Navigate to the file location: C:wampappsphpmyadmin3.2.0.1config.inc.php (For WAMPP Server users)
  2. Locate the line: $cfg['Servers'][$i]['password']=''
  3. Change it to: $cfg['Servers'][$i]['password']='NO'
  4. Save the file and attempt to access phpMyAdmin again. The message should now read "Access denied for user 'root'@'localhost' (using password: YES)."
  5. Finally, set the password in the above line to your desired password, and the issue should be resolved.

The above is the detailed content of Why Does MySQL Reject Access for User \'root\'@\'localhost\' with \"Access Denied\" Error?. 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