MySQL PASSWORD() function

PASSWORD() function

MySQL password() returns a binary string from a plain text password.

The function returns NULL if the string supplied as the argument was NULL.

MySQL server uses this function to encrypt MySQL passwords for storage in the Password column of the user grant table.




Name Description
string A string which is to be encrypted using PASSWORD function.

Syntax Diagram:

MySQL PASSWORD() Function - Syntax Diagram

MySQL Version: 5.6



SELECT PASSWORD('w3resource');


The above MySQL statement encrypts the plain text string w3resource and returns a binary string *EE0804DDC2CC3E85A47191ECCCBA29B775DFFA77.

Sample Output:

mysql> SELECT PASSWORD('w3resource');
| PASSWORD('w3resource')                    |
| *EE0804DDC2CC3E85A47191ECCCBA29B775DFFA77 | 
1 row in set (0.00 sec)

Previous: OLD_PASSWORD()
Next: SHA1()

Follow us on Facebook and Twitter for latest update.

We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook