Home  >  Article  >  Database  >  Why Am I Getting \"Access Denied for User \'root\'@\'localhost\'\" Error in PHPMyAdmin?

Why Am I Getting \"Access Denied for User \'root\'@\'localhost\'\" Error in PHPMyAdmin?

Mary-Kate Olsen
Mary-Kate OlsenOriginal
2024-11-02 19:33:30247browse

Why Am I Getting

Troubleshooting 'Access Denied for User 'root'@'localhost' with PHPMyAdmin

When attempting to update the root password within PHPMyAdmin, users may encounter the following error:

#1045 - Access denied for user 'root'@'localhost' (using password: NO)

This error prevents access to the PHPMyAdmin panel, leaving users perplexed about the cause.

Solution:

The root cause resides in the phpmyadmin config.inc.php configuration file. To rectify the issue, open the file and edit the following code snippet:

$cfg['Servers'][$i]['user'] = '**your-root-username**';
$cfg['Servers'][$i]['password'] = '**root-password**';

Ensure that you replace **your-root-username** with your desired root username and **root-password** with the password you intend to set. Additionally, insert Password before password in the following line:

$cfg['Servers'][$i]['password'] = '**root-password**';  

Edited Code Snippet:

$cfg['Servers'][$i]['user'] = '**your-root-username**';
$cfg['Servers'][$i]['Password'] = '**root-password**';

Once you have made these modifications, save the changes and restart PHPMyAdmin. You should now be able to access the panel and make the necessary password updates without encountering the access denied error.

The above is the detailed content of Why Am I Getting \"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