msyql设置密码报错:ERROR 1372 (HY000): 解决方法详解

MySql给用户设置权限同时指定访问密码时,会提示如下错误:

ERROR 1372 (HY000): Password hash should be a 41-digit hexadecimal number;

 

问题原因:你输入的密码是明文。不允许这么输入。

 

解决办法:用select password('你想输入的密码');查询出你的密码对应的字符串,

然后用这个字符串在创建用户命令中替换你的密码。

 

具体操作如下:

 

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.209.141' IDENTIFIED BY PASSWORD 'mqq2015';

ERROR 1372 (HY000): Password hash should be a 41-digit hexadecimal number

mysql> select password('admin') ;

+-------------------------------------------+

| password('admin')                         |

+-------------------------------------------+

| *4ACFE3202A5FF5CF467898FC58AAB1D615029441 |

+-------------------------------------------+

1 row in set (0.00 sec)

 

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.209.141' IDENTIFIED BY PASSWORD '*4ACFE3202A5FF5CF467898FC58AAB1D615029441';

Query OK, 0 rows affected (0.17 sec)

你可能感兴趣的