Error
Error Code: 3891

MySQL Error 3891: Invalid Current Password Specified

📦 MySQL
📋

Description

Error 3891 indicates that the current password provided during a password change operation does not match the actual password stored for the user. This typically occurs when a user attempts to update their password but makes a mistake in entering their existing credentials.
💬

Error Message

Incorrect current password. Specify the correct password which has to be replaced.
🔍

Known Causes

3 known causes
⚠️
Incorrect Manual Entry
The user made a typographical error or mistype when entering their existing password into the prompt or command.
⚠️
Forgotten Current Password
The user has forgotten or misremembered the correct current password associated with the MySQL account.
⚠️
Password Changed Externally
The user's password was recently updated by another administrator, an automated script, or a different process without their immediate knowledge.
🛠️

Solutions

3 solutions available

1. Verify and Re-enter Current Password easy

The most common cause is a mistyped password.

1
Carefully re-type the current password you believe is correct. Ensure Caps Lock is off and that you are not mistaking similar characters (e.g., 'l' for '1', 'O' for '0').
2
If you are using a tool or script to change the password, double-check the variable or input field where the current password is provided.

2. Reset Password Using an Administrator Account medium

If you've forgotten the current password, reset it via an account with sufficient privileges.

1
Log in to the MySQL server using an administrator account (e.g., 'root') or another account that has the `ALTER USER` privilege. You might need to restart the MySQL server with `skip-grant-tables` if you've lost all administrative credentials (use with extreme caution).
2
Execute the following SQL statement, replacing `'username'` with the user whose password you want to reset and `'new_password'` with the desired new password.
ALTER USER 'username'@'localhost' IDENTIFIED BY 'new_password';
3
If the user connects from a different host, replace `'localhost'` with the appropriate hostname or wildcard (e.g., '%' for any host).
ALTER USER 'username'@'%' IDENTIFIED BY 'new_password';
4
After successfully resetting the password, ensure you flush privileges to apply the changes.
FLUSH PRIVILEGES;

3. Check for Password Expiration or Policy Issues medium

The password might be expired or violate server-side password policies.

1
Connect to the MySQL server as an administrator.
2
Check the password expiration status for the user. If password expiration is enabled, the password might have expired.
SELECT user, host, password_last_changed FROM mysql.user WHERE user = 'username';
SELECT user, host, password_lifetime FROM mysql.user WHERE user = 'username';
3
If the password has expired, you will likely need to reset it using Solution 2. You can also check and modify password policies if they are causing issues.
SHOW VARIABLES LIKE 'default_password_lifetime';
4
If password expiration is not desired, you can set it to 0 (no expiration) for a specific user.
ALTER USER 'username'@'localhost' PASSWORD EXPIRE NEVER;
🔗

Related Errors

5 related errors