Linux & VPS

Fix MySQL "Access Denied for User" (Error 1045)

Access denied for userERROR 1045 (28000)using password: YES
6 min read Updated 12 June 2026 ESAGAMES Team

Error 1045 means MySQL rejected the login. The fix depends on which part failed — the password, the host the user is allowed from, or missing privileges. Here's how to find and fix it.

Read the error carefully

The message tells you a lot: Access denied for user 'app'@'localhost' (using password: YES) means the user, the host (localhost) and that a password was sent. using password: NO means no password was provided at all.

Cause 1: wrong password

The most common cause. Reset it (as root) and update your app config to match:

ALTER USER 'app'@'localhost' IDENTIFIED BY 'new_password';
FLUSH PRIVILEGES;

Cause 2: wrong host

A user defined as app@localhost can't connect from another IP. If your app connects over the network, create/grant the user for that host:

CREATE USER 'app'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON mydb.* TO 'app'@'%';
FLUSH PRIVILEGES;
localhost vs 127.0.0.1

MySQL treats them differently: localhost uses a Unix socket, 127.0.0.1 uses TCP. A user granted on one may be denied on the other. Match how your app actually connects.

Cause 3: missing privileges

The user exists and the password is right, but it has no rights on the database. Grant them as shown above, scoped to the specific database.

Verify the user

SELECT user, host FROM mysql.user WHERE user = 'app';
SHOW GRANTS FOR 'app'@'localhost';
1045 is always user + password + host. Confirm the password, confirm which host the user is allowed from, and confirm the grants.

Databases handled for you

Our managed hosting sets up MySQL/MariaDB with the right users and grants, so game panels and apps just work.

See hosting
FAQ

Frequently asked questions

What does MySQL error 1045 mean?

"Access denied for user" — the login was rejected. It's caused by a wrong password, the user not being allowed from that host, or missing privileges on the database.

Why does it say "using password: YES" but still deny me?

A password was sent but it's wrong, or the user isn't permitted from the host you're connecting from. Reset the password and check the user's host (localhost vs 127.0.0.1 vs %).

What's the difference between localhost and 127.0.0.1 in MySQL?

localhost connects via a Unix socket; 127.0.0.1 connects via TCP. MySQL grants are host-specific, so a user allowed on one might be denied on the other. Grant the host your app actually uses.

Knowledge base

Related articles

Skip the troubleshooting

Managed, protected hosting in Frankfurt — we handle the Linux, the network and the DDoS so you don't have to.

Payments Secure checkout with cards, banking apps and digital wallets.

Choose the payment flow that fits your stack and region without leaving the platform.

Pay by Zen Visa Mastercard Paysafecard PaysafeCash Skrill Trustly Bancontact UnionPay iDeal WebMoney