简体   繁体   中英

How to set the password admin to the user root in mysql?

I have tried something shown below:

SHOW VARIABLES LIKE 'validate_password%';

The output should be something like that:


+--------------------------------------+-------+
| Variable_name                        | Value |
+--------------------------------------+-------+
| validate_password.check_user_name    | ON    |
| validate_password.dictionary_file    |       |
| validate_password.length             | 6     |
| validate_password.mixed_case_count   | 1     |
| validate_password.number_count       | 1     |
| validate_password.policy             | LOW   |
| validate_password.special_char_count | 1     |
+--------------------------------------+-------+

then you can set the password policy level lower, for example:

SET GLOBAL validate_password.length = 6;

SET GLOBAL validate_password.number_count = 0;

The problem is when I set the fields and then restart mysql it again setted to default. I have also tried,

mysql> flush priviledges;

Please help me how can I set the password of my user root to the admin .

You should set up your settings in a configuration file my.cnf .

Check this article for proper path depending on a system you use. https://dev.mysql.com/doc/refman/8.0/en/option-files.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM