Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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
share|improve this question
    
Please do not post the same question to multiple Stack Exchange sites. The Unix & Linux version has been answered as well, which is a waste of effort. –  Gilles Aug 6 '12 at 23:57
    
Forgot your password? Google it! Seriously: anytime a password is stored improperly (without salt), you're likely to be able to invert the hash with Google. –  Gilles Aug 7 '12 at 0:02
add comment

2 Answers

up vote 5 down vote accepted

Just use MySQL:

select password('foo');

PASSWORD('FOO')

*F3A2A51A9B0F2BE2468926B4132313728C250DBF
share|improve this answer
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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