1

Say I have a password "Foobar1234". In MySQL database (5.6), the hash value is

*59C0D3B7983F06CF32F555AD04BAC66BCF952597

I want to try this outside of MySQL database so the SQL query isn't logged. Is the hash function known? I am using the default settings.

Here is the doc: https://dev.mysql.com/doc/refman/5.6/en/password-hashing.html

CppLearner
  • 121
  • 3

1 Answers1

1

This question was explained several times in the DBA StackExchange

I actually learned the formula from a post from PalominoDB (later changed name to Blackbird and then was purchased by Pythian). The post was made Dec 4, 2011 entitled "Hashing Algorithm In MySQL PASSWORD()"

So if you want to execute this function yourself, it would look something like this:

SET @my_new_pass = 'WhateverIWantAsThePassword';
SET @my_new_hash = CONCAT('*',UPPER(SHA1(UNHEX(SHA1(@my_new_pass))))) MySQLPWDHASH;

This would land in the MySQL history ~/.mysql_history but not in the binary logs.

RolandoMySQLDBA
  • 185,223
  • 33
  • 326
  • 536