Monday, September 24, 2012

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


mysql> GRANT * ON *.* TO 'sgoswami'@'121.23.3.13' IDENTIFIED BY PASSWORD "test123";


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

MySql expects you to enter password in an encrypted format. test123 which is been passed above is not in encrypted format and hence the error. 

Use mysql console to find out encrypted value for this password and replace it within your query. 

For e.g., 


mysql> select password('test123');
+---------------------+
| password('test123') |
+---------------------+
| 39817a786ddf7333    | 
+---------------------+
1 row in set (0.00 sec)

mysql> 


Replace test123 in above query with the encrypted password shown above. Note when you login you should use test123 only and not the encrypted one. For security reasons, the password is always stored in encrypted format. 

So, your query should look like below now: 

mysql> GRANT * ON *.* TO 'sgoswami'@'121.23.3.13' IDENTIFIED BY PASSWORD "39817a786ddf7333";

1 comment: