ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Most likely cause: The password entered for the root user is incorrect or does not match what MySQL expects
Try first: Double-check the password
Likely causes
- The password entered for the root user is incorrect or does not match what MySQL expectsmost likely
- The root user has no password set or the password was never configured after installationpossible
- Connection is being attempted with the wrong authentication method or from a host that root is not allowed to useless likely
How to fix it
Double-check the passwordSafe
Confirm you are typing the exact password that was set for the MySQL root user, including any special characters or case differences.
Try connecting with an empty passwordSafe
Run the mysql command without supplying a password to see if the root account currently has no password.
mysql -u rootReset the root password via the MySQL serviceChanges settings
Stop the MySQL service, start it with skip-grant-tables, then set a new password. This requires stopping the database temporarily.
sudo systemctl stop mysql && sudo mysqld_safe --skip-grant-tables &⚠ Stopping the database will interrupt any applications using it; back up any important data first.
If that didn't fix it
Run 'mysql -u root -p' from the command line and note the exact new error message shown.
When to see a technician
If you do not have sudo access or are unsure about stopping the MySQL service, ask your system administrator or database support person for help.
Quick answers
- What does ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) mean?
- MySQL (or MariaDB) rejected the login for the database administrator account called root when connecting from the same computer. The password provided was either wrong, the account has no password set, or the account's permissions do not allow this connection method.
- What causes ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)?
- The password entered for the root user is incorrect or does not match what MySQL expects. (most likely) The root user has no password set or the password was never configured after installation. (possible) Connection is being attempted with the wrong authentication method or from a host that root is not allowed to use. (less likely)
- How do I fix ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)?
- Try these in order, safest first: 1. Double-check the password. 2. Try connecting with an empty password. 3. Reset the root password via the MySQL service.
- What if that didn't fix it?
- Run 'mysql -u root -p' from the command line and note the exact new error message shown.
- When should I see a technician?
- If you do not have sudo access or are unsure about stopping the MySQL service, ask your system administrator or database support person for help.