1698 MySQL Origin: Data Last updated 14 Oct 2026

MySQL ERROR 1698 (28000): Access denied for user 'root'@'localhost'

root uses the auth_socket/unix_socket plugin (Ubuntu/Debian default), so password logins as root fail.

Exact message you may see Access denied for user 'root'@'localhost'
Seen on: MySQL

Meaning

On Ubuntu, root authenticates via the OS user: sudo mysql works, mysql -u root -p doesn’t. Apps should use their own user.

Common causes

  • Ubuntu/Debian default auth_socket for root
  • phpMyAdmin/app trying to log in as root with a password

⚡ Quick fix

  1. Use sudo mysql for admin tasks
  2. Create a dedicated app user with a password
  3. Or switch root to caching_sha2_password (not recommended for apps)

Detailed fix by platform

MySQL

  1. sudo mysql -e "CREATE USER 'admin'@'localhost' IDENTIFIED BY 'StrongPass!'; GRANT ALL ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;"

How to diagnose

  1. Plugin — SELECT user, plugin FROM mysql.user WHERE user='root'
  2. Recent change — Did it start after a deploy, upgrade, or configuration change? Compare with the last working version.

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Data. Errors that are often confused with or caused by this one (click to open):

1045 — MySQL ERROR 1045 (28000): Access denied for user (MySQL)10451130 — MySQL ERROR 1130 (HY000): Host 'x' is not allowed to connect to this MySQL server (MySQL)113018456 — SQL Server: Login failed for user 'x'. (Error 18456) (SQL)1845628P01 — PostgreSQL: FATAL: password authentication failed for user (PostgreSQL)28P01caching_sha2_password — Authentication plugin 'caching_sha2_password' cannot be loaded (MySQL)caching_sha2_passwordORA-01017 — ORA-01017: invalid username/password; logon denied (SQL)ORA-01017role does not exist — FATAL: role "x" does not exist (PostgreSQL)role does not exist1698

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.