Skip to content

Instantly share code, notes, and snippets.

@evgv
Last active March 29, 2017 20:32
Show Gist options
  • Save evgv/e10c8b3f57d09f20a85d7e53ff1658ed to your computer and use it in GitHub Desktop.
Save evgv/e10c8b3f57d09f20a85d7e53ff1658ed to your computer and use it in GitHub Desktop.
MySQL. Password validation plugin

Passowrd validation plugin

MySQL 5.7+ by default haves a Password validation system. In case if you don't want to go strictly with the policy and need to assign your own then just set new validate rules.

First you login with mysql -u root -p and check the current policy rules by typing the command:

SHOW VARIABLES LIKE 'validate_password%';

as example my result

+--------------------------------------+--------+
| Variable_name                        | Value  |
+--------------------------------------+--------+
| validate_password_check_user_name    | OFF    |
| validate_password_dictionary_file    |        |
| validate_password_length             | 8      |
| validate_password_mixed_case_count   | 1      |
| validate_password_number_count       | 1      |
| validate_password_policy             | MEDIUM |
| validate_password_special_char_count | 1      |
+--------------------------------------+--------+

Then you can change any of the above variables at your will:

 SET GLOBAL validate_password_length = 6;
 SET GLOBAL validate_password_number_count = 0;
 SET GLOBAL validate_password_mixed_case_count = 0;
 SET GLOBAL validate_password_special_char_count = 0;

Thereafter you can create a database and a user accessing it with a simpler password(not recommened for production, only for development enviroment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment