mysql 无法向用户授予权限,出现错误:ERROR 1819 (HY000): 您的密码不满足当前的策略要求
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37762895/
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
mysql cannot grant privilege to user, getting error: ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
提问by FDavidov
I am in the process of moving a new application to the Production environment which includes a MySQL DB.
我正在将新应用程序移动到包含 MySQL 数据库的生产环境。
While attempting to grant the required privileges using the command:
尝试使用以下命令授予所需权限时:
GRANT ALTER,CREATE ON `MyDB`.`*` to `ThisUser`@`*` ;
I'm getting the error: ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
.
我收到错误:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
。
and this, while the passwords (of the rootuser as well as of the ThisUser) fully satisfy the current policy:
这一点,虽然密码(root用户和ThisUser 的)完全满足当前策略:
- The length of the passwords are above 8 chars,
- They include both upper and lower case, as well as digits and special chars (like "!", "@", "$", etc.).
- 密码长度超过8个字符,
- 它们包括大写和小写,以及数字和特殊字符(如“!”、“@”、“$”等)。
I tried setting the validate_password_policy
to LOW
but it didn't help either.
我尝试设置为validate_password_policy
,LOW
但它也没有帮助。
Can anyone explain what the issue is and how to resolve it?
任何人都可以解释问题是什么以及如何解决它?
Thanks.
谢谢。
采纳答案by FDavidov
回答by Cubiczx
To solve this problem change validate_password_policy value: ERROR 1819 (HY000): Your password does not satisfy the current policy requirements:
要解决此问题,请更改 validate_password_policy 值:ERROR 1819 (HY000): 您的密码不满足当前策略要求:
$ mysql -u root -p
mysql> SET GLOBAL validate_password_policy=LOW;
And grant privileges to your user:
并授予您的用户权限:
mysql> grant all privileges on DB_NAME.* to 'USER_NAME'@'localhost' identified by 'USER_PASS';
mysql> FLUSH PRIVILEGES;
mysql> exit
$ sudo service mysql reload
$ brew services restart mysql
回答by Andrew
This error some time occurs when you've changed some fields like user host or password but forgotten to flush privileges. So try:
当您更改了某些字段(如用户主机或密码)但忘记刷新权限时,有时会发生此错误。所以尝试:
mysql>flush privileges;
mysql>flush privileges;
回答by AnSh
For me it work when I have added IDENTIFIED BY clause in the GRANT query. You need to use IDENTIFY BY clause when you don't have user already added to mysql.
对我来说,当我在 GRANT 查询中添加 IDENTIFIED BY 子句时,它会起作用。当您还没有将用户添加到 mysql 时,您需要使用 IDENTIFY BY 子句。
GRANT ALTER,CREATE ON MyDB.* to 'UserName'@'%' IDENTIFIED BY 'UserPassword';
回答by Princejr
The problem is as a result of the policy difference between your password and the server password policy, what you need to do is to reset the password policy of the server to match that no of your server. Type in the following commands to access the plug-in for the password policies
问题是由于您的密码和服务器密码策略之间的策略不同,您需要做的是重置服务器的密码策略以匹配您的服务器的密码策略。输入以下命令访问密码策略插件
Sudo MySQL
msql> SHOW VARIABLES LIKE 'validate_password%';
This commands should take you to the table with the password policies of the MySQL server. Now you need to write down your password on a piece of paper and reset the server password policies to match that of your password. To do the type in the following commands.
此命令应将您带到包含 MySQL 服务器密码策略的表。现在您需要在一张纸上写下您的密码并重置服务器密码策略以匹配您的密码。执行以下命令中的类型。
MySQL> SET GLOBAL validate_password_length = 5; ( this should be according to the length of your password)
MySQL> SET GLOBAL validate_number_count = 0;
MySQL> SET GLOBAL validate_password.policy =LOW;
MySQL> SET GLOBAL validate_password_special_char_count = 0;
Note that there are other policies you could change to suit your current password needs. Incase you are using a password generator it's best to delete the password plug in all together, use the following commands in case you want to delete all password policies. MySQL> uninstall plugin validate_password;
请注意,您可以更改其他策略以满足您当前的密码需求。如果您使用的是密码生成器,最好一起删除密码插件,如果您想删除所有密码策略,请使用以下命令。MySQL> 卸载插件validate_password;