Databaseexit code > 0

ERROR 1045 (28000): Access denied for user

$ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Analysis

MySQL/MariaDB rejected the login attempt, usually due to an incorrect password or insufficient permissions for the host.

Common Triggers

  • Incorrect password.
  • The user is trying to connect from a host that is not allowed (e.g., 'user'@'%' vs 'user'@'localhost').

Debug Checks

  • $Check which host the user is allowed to connect from: SELECT host, user FROM mysql.user;.

Resolution

1
Reset the user password.
2
Grant permissions for the specific host: GRANT ALL ON *.* TO 'user'@'host' IDENTIFIED BY 'password';.

Metadata

Tool
Database
Severity
High
Tags
#database#mysql#auth