MySQL Error 1045 (28000): Access denied for user (Host Mismatch)
MySQL differentiates `user@localhost` (socket) from `user@127.0.0.1` and `user@%`.
Runs locally in browser
Free · No login
Independently Verified 2026-11-25
v4.1.0
Identifier: MySQL Error 1045 (28000)
Platform: MySQL
Common Root Causes:
- MySQL differentiates `user@localhost` (socket) from `user@127.0.0.1` and `user@%`.
Interactive Diagnostic Checklist
Verified Solutions:
- Create/grant the exact `user@host` pair and verify authentication plugin.
Safe Diagnostic Command:
SELECT user, host, plugin FROM mysql.user;
Warning: Verify configuration changes in staging or with dry-run flags (e.g. nginx -t) before reloading production services.
Technical Explanation
MySQL differentiates `user@localhost` (socket) from `user@127.0.0.1` and `user@%`. Recommended diagnostic: `SELECT user, host, plugin FROM mysql.user;`. Remediation: Create/grant the exact `user@host` pair and verify authentication plugin.
Worked Examples
- Run `SELECT user, host, plugin FROM mysql.user;` to verify root cause before applying the remediation.
Limitations & Assumptions
- Always verify configuration changes in staging or with dry-run flags (e.g. `nginx -t`) before reloading production services.
Source References & Verification
Resource ID: err-mysql-1045-access-denied-user · Independently verified: 2026-11-25