ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
Create a user in Mysql in linux
login to mysql as a root
mysql -u root -p
now create user with following command
CREATE USER ‘testdb’@’localhost’ IDENTIFIED BY ‘test123’;
if you got error like below.
ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘Root@1234’;then it will show like “Query OK, 0 rows affected (0.00 sec)”
now try again the step to create user as per the password policy.
If you don’t want password policy and you want to create user password with some random simple password then follow the step below.
login mysql as root
mysql -u root -p
then check the policy status with below command
SHOW VARIABLES LIKE ‘validate_paswword%’;
it will show like below image.
you can see the validate_password_policy in MEDIUM.
now you have to change to LOW. So you can proceed in your own way. Now set the paoly rule in low with following command.
SET GLOBAL validat_password_policy=LOW;
mysql> SET GLOBAL validate_password_length = 4;
Query OK, 0 rows affected (0.01 sec)
mysql> SHOW VARIABLES LIKE ‘validate_password%’;
+————————————–+——–+
| Variable_name | Value |
+————————————–+——–+
| validate_password_dictionary_file | |
| validate_password_length | 4 |
| validate_password_mixed_case_count | 1 |
| validate_password_number_count | 1 |
| validate_password_policy | MEDIUM |
| validate_password_special_char_count | 1 |
+————————————–+——–+
6 rows in set (0.00 sec)
mysql> SET GLOBAL validate_password_policy = LOW;
Query OK, 0 rows affected (0.01 sec)
For checking, you can run the command
SHOW VARIABLES LIKE 'performance_schema';
Suppose, now you will see OFF
To enable it, start the server with the performance_schema variable enabled. For example, use these lines in your my.cnf file:
[mysqld]
performance_schema=ON
More details you can found in official documentation:
Recent Comments