MySQL error 1698: Access denied for user (no password)
Login denied for an account that authenticates without a password check, most often root using auth_socket on Ubuntu or Debian.
- Error number
1698- Name
ER_ACCESS_DENIED_NO_PASSWORD_ERROR- SQLSTATE
28000- Category
- Access and privileges
What it means
1698 is an access-denied error for accounts whose plugin doesn't take a password. On Ubuntu and Debian, 'root'@'localhost' uses auth_socket, which lets you in only if your operating-system user is also root. Logging in as root from a normal user, or from an app with a password, fails with 1698.
Common causes
- Running
mysql -u root -pas a normal operating-system user on a system where root usesauth_socket. - An application connecting as
rootwith a password to such a server.
How to fix it
-
Log in as the operating-system root user, which
auth_socketaccepts:sudo mysql. -
Create a separate account with a password for applications and tools, instead of changing root.
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'strong-password'; GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
-
Or, if you really want password login for root, change its plugin.
ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'strong-password';
Related errors
More access and privileges errors
1044Access denied for user to database1142Command denied to user for table1143Command denied to user for column1227Access denied; you need a privilege1396Operation CREATE USER failed1419SUPER privilege needed with binary logging1449Definer user does not exist
The code and message text are from the MySQL 8.4 Error Message Reference. Browse the full MySQL error list or search every database error.
Work on MySQL in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for MySQL and the other databases you use.