Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a user who updated his sql connector to 6.6.5 and not he cannot run his code due to the passwords being hashed in the older format (pre 4.1?). I would like to update all of the mysql accounts to the newer format unfortunately I do not know all of the passwords. I recently migrated to a new server (5.1.67), but I simply did a show grants for each user and copied the info into the new server.

Is there any way to simply tell it to update all the hashes to the new format without supplying the original password? There are several systems running code that relies on these passwords (hardcoded), so I can't simply ask users to reset their passwords very easily.

On CentOS 6.3 mysql 5.1.67

share|improve this question
up vote 0 down vote accepted

Quick Answer: NO, you cannot rehash an existing hash value and still retain its original meaning.

A hash by definition is a many --> one encoding. As the hash value cannot be returned to its original value, it is impossible to rehash a hash value so that the original coding remains intact.

share|improve this answer
Thanks for your answer. I ended up simply getting that one user's password and setting old_passwords to off then rehashing using the 41 byte hash and issuing a flush-hosts. This worked. – user160910 Apr 8 '13 at 15:28

Your Answer


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