Thursday, September 12, 2013

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



When you creating a new user for a MySQL server with the below method sometime you may get this below error.

Ex:

mysql>grant all privileges on *.* to 'root'@'localhost' identified by password 'welcome';

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


Solution:

mysql> select password ('welcome');

+-------------------------------------------+
| password ('welcome')           |
+-------------------------------------------+
| *DF216F57F1F2066124E1AA5491D995C3CB57E4C2 |
+-------------------------------------------+

1 row in set (0.02 sec)

mysql>grant all privileges on *.* to 'root'@'localhost' identified by password '*DF216F57F1F2066124E1AA5491D995C3CB57E4C2';

 Query OK, 0 rows affected (0.02 sec)

mysql>flush privileges;

 Query OK, 0 rows affected (0.02 sec)


Now the error gone.Try this when you are getting this error.


Better always try this below way to create MySQL user.

mysql>grant all privileges on *.* to 'root'@'localhost' identified by 'welcome';

Query OK, 0 rows affected (0.00 sec)

mysql>flush privileges;

Query OK, 0 rows affected (0.02 sec)



No comments:

Post a Comment