Password hash issue with mysql

Password hash error normally seen in older version of mysql and also can cause due to some mysql settings.

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

Some of you might came across with the above error while granting privileges for mysql users via command line console.

In this case instead of password we need to give the Hex code for the password which you are trying. You can get the Hex code of the pass using the below steps

mysql> select password ('P@SHRC@Uhfg');

+-------------------------------------------+
| password ('P@SHRC@Uhfg') |
+-------------------------------------------+
| *DF216F577656GV856VO85FJP86BCSE4C2 |
+-------------------------------------------+
1 row in set (0.02 sec)

Once  you got the Hex code, you need to replace the password in the grantall command with the hex code like the below one 

mysql>grant all privileges on *.* to 'root'@'localhost' identified by password '*DF216F577656GV856VO85FJP86BCSE4C2';
Query OK, 0 rows affected (0.02 sec)

mysql>flush privileges;
Query OK, 0 rows affected (0.02 sec)

Mysql hash password

Mysql hash password

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *