2

I've created a user ... but forgotten the password

mysql> create user 'blayo'@'%' identified by 'right';

Which Linux command line tool can encrypt the password the same way mysql does ?

mysql> select Password,User from mysql.user
------------------------------------------+-------+
*920018161824B14A1067A69626595E68CB8284CB | blayo |

...to be sure I use the right one

$ tool right
*920018161824B14A1067A69626595E68CB8284CB
2

2 Answers 2

5

Just use MySQL:

select password('foo');

PASSWORD('FOO')

*F3A2A51A9B0F2BE2468926B4132313728C250DBF
1
  • It's also super-handy how this stores your new password in clear text in both your bash history log and in your MySQL log, for easy retrieval later on. ;-) Sep 14, 2014 at 18:18
4

MySql uses SHA1 to hash the password in the following way and then prefix's it with a star:

SHA1(SHA1(password));

The argument to the outer SHA1 must be the binary result of the inner hash for it to work properly.

source: MySQL source code and the following link:

http://palominodb.com/blog/2011/12/04/hashing-algorithm-mysql-password

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.