Error
Error Code: 1862

MariaDB Error 1862: Password Expired, Requires Change

📦 MariaDB
📋

Description

This error indicates that your MariaDB account password has reached its expiration date and is no longer valid for logging in. The server's security policy prevents access until the password is successfully changed using a compatible client application.
💬

Error Message

Your password has expired. To log in you must change it using a client that supports expired passwords.
🔍

Known Causes

3 known causes
⚠️
Server Password Expiration Policy
The MariaDB server is configured with a password expiration policy that automatically invalidates user passwords after a predefined period.
⚠️
Manually Expired Password
An administrator explicitly set your specific user account's password to expire immediately or at a designated future date.
⚠️
Unsupported Client for Password Change
The client application you are using lacks the necessary features or protocol support to facilitate changing an expired password directly.
🛠️

Solutions

3 solutions available

1. Change Password Using `mysql_change_password` (Recommended) easy

Utilize the dedicated MariaDB utility for password expiration.

1
Log in to the MariaDB server from a client that supports expired passwords. This is often the command-line client.
mysql -u your_username -p
2
When prompted for your password, enter your current (expired) password.
Enter password: *****
3
MariaDB will then prompt you to change your password. Follow the on-screen prompts to enter your new password twice.
Enter new password: 
Enter password confirmation: 
4
If successful, you will see a message indicating the password has been updated. You can then log out and log back in with your new password.
mysql> QUIT

2. Change Password Directly via SQL Command easy

Force a password change using an SQL statement if the client doesn't handle it automatically.

1
Connect to the MariaDB server using the command-line client, even if you encounter the password expired error. You might need to use a client that doesn't strictly enforce password expiration on initial connection.
mysql -u your_username -p
2
Enter your current (expired) password when prompted.
Enter password: *****
3
Once connected, execute the `SET PASSWORD` command to change your password. Replace `your_new_password` with your desired new password.
SET PASSWORD FOR 'your_username'@'localhost' = PASSWORD('your_new_password');
FLUSH PRIVILEGES;
4
After successfully changing the password and flushing privileges, log out and log back in with your new password.
mysql> QUIT

3. Temporarily Disable Password Expiration Policy medium

Disable the expiration policy for a user to allow login, then change the password.

1
Connect to the MariaDB server as a user with sufficient privileges (e.g., root) using a client that can establish a connection.
mysql -u root -p
2
Alter the user's account to disable password expiration. Replace `'your_username'@'localhost'` with the actual user and host.
ALTER USER 'your_username'@'localhost' PASSWORD EXPIRE NEVER;
FLUSH PRIVILEGES;
3
Now, log out and log in as `your_username` using a client that supports expired passwords (as in Solution 1) or via SQL to set a new password.
mysql -u your_username -p
4
Once logged in as `your_username`, change the password as usual (using Solution 1 or 2).
SET PASSWORD = PASSWORD('your_new_password');
FLUSH PRIVILEGES;
5
Optionally, re-enable password expiration for the user after they have successfully set a new password.
ALTER USER 'your_username'@'localhost' PASSWORD EXPIRE DEFAULT;
FLUSH PRIVILEGES;
🔗

Related Errors

5 related errors