Home >Database >Mysql Tutorial >Why am I getting \'Access denied for user \'root\'@\'localhost\'\' when setting my root password in PHPMyAdmin?

Why am I getting \'Access denied for user \'root\'@\'localhost\'\' when setting my root password in PHPMyAdmin?

Patricia Arquette
Patricia ArquetteOriginal
2024-11-02 17:02:02317browse

Why am I getting

Resolving Access Denied Issue for 'root' User in PHPMyAdmin

Users may encounter an access denied error when attempting to set a root password in PHPMyAdmin. The message typically reads, "Access denied for user 'root'@'localhost' (using password: NO)."

Root Cause:

PHPMyAdmin is unable to connect to the database using the provided root credentials.

Solution:

To rectify this issue, you need to edit the phpmyadmin config.inc.php file. Locate the following code block:

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

Ensure that the "Password" string appears before the password value as shown below:

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

Additionally, verify that the root username and password are correct. Save the file and try accessing PHPMyAdmin again. The error should now be resolved, granting you access to the panel.

The above is the detailed content of Why am I getting \'Access denied for user \'root\'@\'localhost\'\' when setting my root password 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