简体   繁体   English

mysql中的用户root如何设置密码admin?

[英]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: output 应该是这样的:


+--------------------------------------+-------+
| 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.问题是当我设置字段然后重新启动 mysql 时,它再次设置为默认值。 I have also tried,我也试过,

mysql> flush priviledges;

Please help me how can I set the password of my user root to the admin .请帮助我如何将我的用户root的密码设置为admin

You should set up your settings in a configuration file my.cnf .您应该在配置文件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 https://dev.mysql.com/doc/refman/8.0/en/option-files.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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