Last active
February 24, 2021 05:49
-
-
Save iandark/39e426289bb433494db8bc206ce3d665 to your computer and use it in GitHub Desktop.
MySQL 8 change password strengh in my.cnf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 1 - Edit your my.cnf | |
| $ sudo nano /etc/mysql/my.cnf | |
| // 2 - In your my.cnf, add this to section [mysqld], if your file doesn't have this section you should create | |
| [mysqld] | |
| validate_password.length = 4 | |
| validate_password.policy = low | |
| validate_password.mixed_case_count = 0 | |
| validate_password.number_count = 0 | |
| validate_password.special_char_count = 0 | |
| validate_password.check_user_name = 0 | |
| // 3 (optional) - if you can't login into mysql console add this in [mysqld] section: | |
| skip-grant-tables | |
| // 4 - Restart your mysql service | |
| $ sudo service mysql restart | |
| // 5 - Now you should be able to login in your mysql console | |
| $ mysql -u root | |
| // 6 - See your password strength | |
| mysql> SHOW VARIABLES LIKE 'validate_password%'; | |
| // your output will be something like this: | |
| +--------------------------------------+-------+ | |
| | Variable_name | Value | | |
| +--------------------------------------+-------+ | |
| | validate_password.check_user_name | OFF | | |
| | validate_password.dictionary_file | | | |
| | validate_password.length | 4 | | |
| | validate_password.mixed_case_count | 0 | | |
| | validate_password.number_count | 0 | | |
| | validate_password.policy | LOW | | |
| | validate_password.special_char_count | 0 | | |
| +--------------------------------------+-------+ | |
| 7 rows in set (0.00 sec) | |
| // 7 - Change your root password, where 'pass' will be your password | |
| mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'pass'; | |
| // or | |
| mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'pass'; | |
| // 8 - Flush privileges | |
| mysql> FLUSH PRIVILEGES; | |
| // 9 - Finally, exit mysql console (CTRL+D), and restart your mysql service | |
| $ sudo service mysql restart |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
fix: change visibilty of this gist