MySQL 您的密码不符合当前的政策要求
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/43094726/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Your password does not satisfy the current policy requirements
提问by Nguyen
I want to create a new user in mysql with syntax:
我想使用以下语法在 mysql 中创建一个新用户:
create user 'demo'@'localhost' identified by 'password';
But it returns an error:
但它返回一个错误:
Your password does not satisfy the current policy requirements.
您的密码不满足当前的策略要求。
I have tried many passwords but they don't work. How can I fix this?
我尝试了很多密码,但都不起作用。我怎样才能解决这个问题?
回答by Hung Nguyen
Because of your password. You can see password validate configuration metricsusing the following query in MySQL client:
因为你的密码。您可以在 MySQL 客户端中使用以下查询查看密码验证配置指标:
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;
check the MySQL Documentation.
检查MySQL 文档。
回答by kennyut
NOTE: This might not be a secure solution. But if you are working on a test environment, just need a quick fix and doesn't even care about the security settings. This is a quick solution.
注意:这可能不是一个安全的解决方案。但如果您在测试环境中工作,只需要快速修复,甚至不关心安全设置。这是一个快速的解决方案。
The same issue happened to me when I ran "mysql_secure_installation" and modified password security level to 'medium'.
当我运行“mysql_secure_installation”并将密码安全级别修改为“中”时,同样的问题发生在我身上。
I bypassed the error by running the followings:
我通过运行以下命令绕过了错误:
mysql -h localhost -u root -p
mysql>uninstall plugin validate_password;
make sure you reinstall the plugin "validate_password" if necessary.
如有必要,请确保重新安装插件“validate_password”。
回答by singh
If you don't care what the password policy is. You can set it to LOW by issuing below mysql command:
如果您不在乎密码策略是什么。您可以通过发出以下 mysql 命令将其设置为 LOW:
mysql> SET GLOBAL validate_password_policy=LOW;
回答by Philip
For MySQL 8*
对于 MySQL 8*
SET GLOBAL validate_password.policy=LOW
SET GLOBAL validate_password.policy=LOW
Reference Link to explain about policy - Click Here
政策说明参考链接 -点击这里
回答by Leo Sammy
After running the command sudo mysql_secure_installation
.
运行命令后sudo mysql_secure_installation
。
- Run
sudo mysql
to enter into the mysql prompt. - Run this
SELECT user,authentication_string,plugin,host FROM mysql.user;
to check for user rootto have as plugin auth_socket. - Then do run
uninstall plugin validate_password;
to drop priviledges before running thisALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
Be sure to change passwordto a strong password.
- 运行
sudo mysql
进入mysql提示符。 - 运行它
SELECT user,authentication_string,plugin,host FROM mysql.user;
以检查用户root作为插件auth_socket。 - 然后在运行
uninstall plugin validate_password;
之前运行以删除权限,ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
请确保将密码更改为强密码。
NOTE: check out this link https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-18-04for more help
注意:查看此链接https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-18-04以获得更多帮助
回答by Ruchira
You have to change MySQL password policy to LOW.
您必须将 MySQL 密码策略更改为 LOW。
login as root
以 root 身份登录
mysql -u root -p
change policy
改变政策
SET GLOBAL validate_password_policy=LOW;
or
或者
SET GLOBAL validate_password_policy=0;
exit
出口
exit
restart MySQL service
重启 MySQL 服务
sudo service mysqld restart
You have to change the MySQL password policy to Low = 0 / Medium = 1 / High = 2.
您必须将 MySQL 密码策略更改为 Low = 0 / Medium = 1 / High = 2。
SET GLOBAL validate_password_policy=0;
SET GLOBAL validate_password_policy=1;
SET GLOBAL validate_password_policy=2;
回答by Javasick
For MySql 8 you can use following script:
对于 MySql 8,您可以使用以下脚本:
SET GLOBAL validate_password.LENGTH = 4;
SET GLOBAL validate_password.policy = 0;
SET GLOBAL validate_password.mixed_case_count = 0;
SET GLOBAL validate_password.number_count = 0;
SET GLOBAL validate_password.special_char_count = 0;
SET GLOBAL validate_password.check_user_name = 0;
ALTER USER 'user'@'localhost' IDENTIFIED BY 'pass';
FLUSH PRIVILEGES;
回答by Harish Kumar Saini
In my opinion setting the "validate_password_policy"to "low"or uninstalling the "validate password plugin" is not the right thing to do. You must never compromise with security of your database (unless you don't really care). I am wondering why people are even suggesting these options when you simply can pick a good password.
在我看来,将“validate_password_policy”设置为“low”或卸载“validate password plugin”并不是正确的做法。您绝不能妥协数据库的安全性(除非您真的不在乎)。我想知道当您只需选择一个好的密码时,为什么人们甚至会建议这些选项。
To overcome this problem, I executed following command in mysql: SHOW VARIABLES LIKE 'validate_password%'as suggested by @JNevill. My "validate_password_policy" was set to Medium, along with other things. Here is the screenshot of its execution: Validate Password Policy
为了克服这个问题,我在 mysql 中执行了以下命令:按照@JNevill 的建议,SHOW VARIABLES LIKE 'validate_password%'。我的“validate_password_policy”和其他东西一起被设置为“中等”。这是其执行的屏幕截图:验证密码策略
The result is self explanatory. For a valid password(when Password policy is set to medium):
结果是不言自明的。对于有效密码(当密码策略设置为中时):
- Password must be atleast 8 characters long
- Mixed case count is 1 (Atleast 1 letter in small and 1 letter in caps)
- Number count is 1
- Minimum special Character count is 1
- 密码长度必须至少为 8 个字符
- 混合大小写计数为 1(至少 1 个小写字母和 1 个大写字母)
- 数量为 1
- 最小特殊字符数为 1
So a valid password must obey the policy. Examples of valid password for above rules maybe:
因此,有效的密码必须遵守该策略。上述规则的有效密码示例可能是:
- Student123@
- NINZAcoder$100
- demoPass#00
- 学生123@
- NINZAcoder$100
- 演示通行证#00
You can pick any combination as long as it satisfies the policy.
只要满足策略,您可以选择任意组合。
For other "validate_password_policy"you can simply look the values for different options and pick your password accordingly(I haven't tried for "HIGH").
对于其他“validate_password_policy”,您可以简单地查看不同选项的值并相应地选择您的密码(我没有尝试过“HIGH”)。
回答by Oroki
Step 1: check your default authentication plugin
第 1 步:检查您的默认身份验证插件
SHOW VARIABLES LIKE 'default_authentication_plugin';
Step 2: veryfing your password validation requirements
第 2 步:满足您的密码验证要求
SHOW VARIABLES LIKE 'validate_password%';
Step 3: setting up your user with correct password requirements
第 3 步:使用正确的密码要求设置您的用户
CREATE USER '<your_user>'@'localhost' IDENTIFIED WITH '<your_default_auth_plugin>' BY 'password';
回答by Anurag Sahu
I had the same Problem and the Answer is just Right in front of you, remember when you ran the script while installing mysql like
我有同样的问题,答案就在你面前,记得你在安装 mysql 时运行脚本时
sudo mysql_secure_installation
sudo mysql_secure_installation
there somewhere you chose which password type would you like to chose
您在某处选择了您要选择的密码类型
There are three levels of password validation policy:
密码验证策略分为三个级别:
LOW Length >= 8 MEDIUM Length >= 8, numeric, mixed case, and special characters STRONG Length >= 8, numeric, mixed case, special characters and dictionary file
LOW Length >= 8 MEDIUM Length >= 8,数字、大小写混合和特殊字符 STRONG Length >= 8,数字、混合大小写、特殊字符和字典文件
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG:
请输入 0 = 低,1 = 中,2 = 强:
you have to give a password to same policy
您必须为相同的策略提供密码
here are some sample examples for your passwords:
for type 0: abcdabcd
for type 1: abcd1234
for type 2: ancd@1234
以下是一些密码示例:
对于类型 0:abcdabcd
对于类型 1:abcd1234
对于类型 2:ancd@1234