Password() function

from the Artful MySQL Tips List


Before version 8.0, MySQL used this function to create password hashes. 8.0 removed the function, replacing the functionality with upgraded ALTER USER syntax.

Some developers have relied on PASSWORD() for password hashing in their own apps. There are better solutions (see https://dev.mysql.com/doc/refman/8.0/en/encryption-functions.html), but if you need backward compatibility, for PASSWORD("thispasswd") here is the computational equivalent ...

CONCAT( '*', UPPER(SHA1(UNHEX(SHA1('thispasswd')))) )

Last updated 26 Oct 2020


Return to the Artful MySQL Tips page