mysql_问题记录

创建用户的时候,提示密码不符合规则

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

 

解决办法:

首先,修改validate_password_policy参数的值

mysql> set global validate_password_policy=0; Query OK, 0 rows affected (0.00 sec)

这样,判断密码的标准就基于密码的长度了。这个由validate_password_length参数来决定。

mysql> select @@validate_password_length; +----------------------------+ | @@validate_password_length | +----------------------------+ | 8 | +----------------------------+ 1 row in set (0.00 sec)

validate_password_length参数默认为8,它有最小值的限制,最小值为:

validate_password_number_count
+ validate_password_special_char_count + (2 * validate_password_mixed_case_count)

其中,validate_password_number_count指定了密码中数据的长度,validate_password_special_char_count指定了密码中特殊字符的长度,validate_password_mixed_case_count指定了密码中大小字母的长度。

这些参数,默认值均为1,所以validate_password_length最小值为4,如果你显性指定validate_password_length的值小于4,尽管不会报错,但validate_password_length的值将设为4。如下所示:

mysql> select @@validate_password_length; +----------------------------+ | @@validate_password_length | +----------------------------+ | 8 | +----------------------------+ 1 row in set (0.00 sec) mysql> set global validate_password_length=1; Query OK, 0 rows affected (0.00 sec) mysql> select @@validate_password_length; +----------------------------+ | @@validate_password_length | +----------------------------+ | 4 | +----------------------------+ 1 row in set (0.00 sec)

 

2:创建数据库时,提示拒绝访问

错误代码是Access denied for user ‘root‘@‘%‘ to database ‘xxx

确保有该数据库的前提下,用root权限进入mysql命令行,输入下面命令:
grant all on xxxx.* to ‘root‘@‘%‘ identified by ‘password‘ with grant option;  
 
xxxx代表创建的数据库;  
password为用户密码,在此为数据库的密码