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

If you are getting the following error while creating a user through MySQL Prompt:

mysql> create user test identified by password ‘test345’;
ERROR 1372 (HY000): Password hash should be a 41-digit hexadecimal number

This is because MySQL expects you to enter password in an encrypted format.

You can resolve this error by following the steps given below.

mysql> select password(‘test345’);
+———————+
| password(‘test345’) |
+———————+
| 2ff898e158cd0311 |
+———————+
+-------------------------+
1 row in set (0.00 sec)

mysql> create user test identified by password ‘2ff898e158cd0311′;
Query OK, 0 rows affected (0.00 sec)

That’s it.