Common SQL Errors

MySQL Error 1698: ER_ACCESS_DENIED_NO_PASSWORD_ERROR - How to Fix and Prevent

Galaxy Team
August 7, 2025

<p>MySQL returns ER_ACCESS_DENIED_NO_PASSWORD_ERROR when a connection attempt uses an account without a defined password or with an empty password string.</p>

Sign up for the latest in common SQL errors from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

What is MySQL error 1698 ER_ACCESS_DENIED_NO_PASSWORD_ERROR?

<p>MySQL Error 1698: ER_ACCESS_DENIED_NO_PASSWORD_ERROR occurs when you try to connect with a user that has no password set or the server forbids passwordless logins. Set a secure password or update authentication settings to resolve the issue.</p>

Error Highlights

Typical Error Message

Access denied for user '%s'@'%s'

Error Type

Authentication Error

Language

MySQL

Symbol

ER_ACCESS_DENIED_NO_PASSWORD_ERROR

Error Code

1698

SQL State

28000

Explanation

Table of Contents

What is MySQL error 1698 ER_ACCESS_DENIED_NO_PASSWORD_ERROR?

Error 1698 signals that MySQL has rejected the connection because the specified account lacks a valid password. The server blocks passwordless access when its authentication plugin or configuration requires credentials.

The message format is: Access denied for user 'user'@'host'. It surfaces during CLI logins, application startups, and GUI connections when the password field is empty or NULL.

What Causes This Error?

The error appears when the mysql.user table stores an empty authentication_string for the account while the server enforces password validation. It also arises if the client omits the password flag during connection.

Default Ubuntu and MariaDB packages often create system accounts that must use the UNIX_SOCKET plugin, leading to this denial when attempting password-based logins.

How to Fix ER_ACCESS_DENIED_NO_PASSWORD_ERROR

Set a strong password for the affected account, or configure the account to use its intended authentication plugin. Use ALTER USER with IDENTIFIED BY for standard passwords, or switch to mysql_native_password if needed.

If the account should be socket authenticated, log in with sudo mysql, then either add a password or create a separate user for remote access.

Common Scenarios and Solutions

Ubuntu root user fails with mysql -u root -p: remove the -p flag because the root account authenticates via the system socket. Application containers fail: create a dedicated user with password and GRANT privileges.

CI pipelines break after MySQL upgrade: ensure the pipeline sets MYSQL_ROOT_PASSWORD or uses an account that matches the new auth policy.

Best Practices to Avoid This Error

Always create named service accounts with explicit passwords. Avoid reusing the root account in application code. Store credentials in environment variables or secret managers.

Regularly audit the mysql.user table for empty authentication_string values and enforce strong password policies with the validate_password plugin.

Related Errors and Solutions

ER_ACCESS_DENIED_ERROR (1045) occurs when the password is wrong rather than missing. ER_DBACCESS_DENIED_ERROR (1044) triggers when the user lacks database privileges. Fix them by correcting credentials or granting permissions.

Common Causes

Empty authentication_string field

The user entry exists but the authentication_string column is blank, leaving MySQL with no password to validate.

Socket-only root account

Default installations on Debian or Ubuntu create root@localhost that authenticates through unix_socket. Supplying a password triggers the error.

Client omits --password flag

Scripting tools or humans forget to pass -p or MYSQL_PWD, so MySQL attempts a passwordless login and fails.

Strict password policy enabled

A DBA enabled validate_password or caching_sha2_auth, prohibiting accounts without secure passwords.

Migrated accounts

After restoring a dump, authentication plugins mismatch current server defaults, leaving some users without valid passwords.

Related Errors

MySQL Error 1045: ER_ACCESS_DENIED_ERROR

Triggers when the supplied password is incorrect. Resolve by resetting the password or verifying credentials.

MySQL Error 1044: ER_DBACCESS_DENIED_ERROR

Occurs when the user lacks privileges on the requested database. Grant required rights with GRANT statements.

MySQL Error 1130: ER_HOST_NOT_PRIVILEGED

Happens when the host portion of the user account does not match the connecting client. Add a specific host entry or use '%'.

FAQs

Can I allow passwordless logins safely?

Only in tightly controlled environments. Use socket or SSL certificates rather than empty passwords for better security.

Why does root work without a password on Ubuntu?

Ubuntu installs MySQL with the root account using the unix_socket plugin, delegating authentication to the operating system rather than a password.

How do I fix this error inside a Docker container?

Pass MYSQL_ROOT_PASSWORD or MYSQL_USER and MYSQL_PASSWORD as environment variables when starting the container, or run ALTER USER after the container launches.

How does Galaxy help prevent this error?

Galaxy stores encrypted credentials per connection and warns if you attempt to connect with an empty password, reducing the chance of this authentication failure.

Start Querying with the Modern SQL Editor Today!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Check out some other errors

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo