mysql>中创建密码报错,解决办法:
mysql> create user ying@127.0.0.1 identified by password "12345qwert";
ERROR 1372 (HY000): Password hash should be a 41-digit hexadecimal number
注释:密码哈希算法为41位十六进制加密算法。
也就是说密码应该为加密的密码。
解决措施:查找到明文的密码加密后的对应值
mysql> select password('12345qwert');
+-------------------------------------------+
| password('12345qwert') |
+-------------------------------------------+
| *41DA2FB717B0761640FBDD9C889C372DC8CB6FAA |
+-------------------------------------------+
然后再去创建用户:
mysql> create user ying@127.0.0.1 identified by password '*41DA2FB717B0761640FBDD9C889C372DC8CB6FAA';
Query OK, 0 rows affected (0.00 sec)
mysql> select host,user,password from mysql.user;
+-----------------------+------+-------------------------------------------+
| host | user | password |
+-----------------------+------+-------------------------------------------+
| localhost | root | *41DA2FB717B0761640FBDD9C889C372DC8CB6FAA |
| localhost.localdomain | root | |
| 127.0.0.1 | root | |
| ::1 | root | |
| localhost | | |
| localhost.localdomain | | |
| % | xin | *41DA2FB717B0761640FBDD9C889C372DC8CB6FAA |
| 127.0.0.1 | ying | *41DA2FB717B0761640FBDD9C889C372DC8CB6FAA |
+-----------------------+------+-------------------------------------------+