The PASSWORD
function has a basic implementation. It's just two rounds of SHA-1 hashing.
Meaning we can reimplement it as follows:
SELECT CONCAT('*', UPPER( SHA1( UNHEX( SHA1('mypassword') ) ) ) )
So all that you need to do is to replace all calls to the PASSWORD
function in your sql with this and it should do the same job regardless of your mysql version.
For example
SELECT userName, firstName FROM Users WHERE userName='myuser' AND password = PASSWORD('mypassword')
Becomes
SELECT userName, firstName FROM Users WHERE userName='myuser' AND password = (SELECT CONCAT('*', UPPER(SHA1(UNHEX(SHA1('$password'))))))
Hope that helps.