Usually, we come across ‘MySQL error 1819’ while creating a MySQL user with a relatively weak password.
Technically, this is not an error. Instead, it is a notification that says we are using a password that does not meet the recommended password policy requirements.
Here at Bobcares, we often receive requests to resolve the MySQL errors as a part of our Server Management Services for web hosts and online service providers.
Today, let us see how efficiently our Support Engineers fix this MySQL error.
Know more about the MySQL error 1819 (HY000)
This error means that we are using a weak password.
For example, when creating a user, this error occurred.
mysql> create user ‘bob’@’localhost’ IDENTIFIED BY ‘mypassword’;
Copy Code
Here the password is extremely weak and can present a security risk.
The MySQL database ships with a validate_password plugin which when enabled, enforces a password validation policy. The plugin enforces 3 levels of a password validation policy. They are:
- LOW: Allows users to set a password of 8 or fewer characters.
- MEDIUM: Allows users to set a password of 8 or fewer characters with mixed cases and special characters.
- STRONG: Allows users to set a password that has all the attributes of a medium-level password with the inclusion of a dictionary file.
The password policy is set to MEDIUM by default. We run the below command to confirm the password policy level.
$ SHOW VARIABLES LIKE ‘validate_password%’;
Copy Code
In case, if we run the command and get the output empty set, then the plugin is not enabled yet.
In order to enable the plugin, we run the below commands.
mysql> select plugin_name, plugin_status from information_schema.plugins where plugin_name like ‘validate%’;
mysql> install plugin validate_password soname ‘validate_password.so’;
Copy Code
Then, to confirm the activation of the plugin, we run the below command.
mysql> select plugin_name, plugin_status from information_schema.plugins where plugin_name like ‘validate%’;
Copy Code
How to fix MySQL error 1819 (HY000) in Linux
Now let’s take a look at how our Support Engineers resolve this error message.
In order to resolve this error message, we set the password validation policy to the lowest level. In return, this will create an avenue for setting weak passwords which can ultimately cause our database to be compromised by hackers.
Here are the steps to change the MySQL Password Validation Policy
First, we set a lower password validation policy.
mysql> SET GLOBAL validate_password_policy=LOW;
Copy Code
OR
mysql> SET GLOBAL validate_password_policy=0;
Copy Code
Then we can confirm the password validation policy level.
$ SHOW VARIABLES LIKE ‘validate_password%’;
Copy Code
Now we can proceed and assign a relatively weak password as per our wish.
mysql> create user ‘bob’@’localhost’ IDENTIFIED BY ‘mypassword’;
Copy Code
If we want to revert to the ‘MEDIUM’ password policy level, then we can run the below command.
mysql> SET GLOBAL validate_password_policy=MEDIUM;
Copy Code
In case, if the password policy doesn’t change then we exit from the MySQL prompt and restart the MysqL service from Terminal window.
$ sudo systemctl restart mysql
Copy Code
Disable password validation policy
If we want to create users with weak password, we simply disable the Validate Password component altogether and re-enable it back after creating the users.
We run the below command to log into the MySQL server:
$ mysql -u root -p
Copy Code
We run the following command to temporarily disable Validate Password component.
mysql> UNINSTALL COMPONENT “file://component_validate_password”;
Copy Code
Then we create the users with any password.
mysql> create user ‘kumar’@’localhost’ identified by ‘123456’;
Copy Code
After that, we enable the Validate Password component. For that, we run the below command.
mysql> INSTALL COMPONENT “file://component_validate_password”;
Copy Code
[Need any further assistance in fixing MySQL error? – We’ll help you]
Conclusion
In short, this MySQL error occurs while creating a MySQL user with a relatively weak password. Today, we saw how our Support Engineers fix this MySQL error.
0 Comments