Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

MySQL OLD_PASSWORD() function

OLD_PASSWORD() function

MySQL old_password() returns a binary string from a plain text password and intended to be used to reset passwords for any pre-4.1 MySQL clients that need to connect to MySQL server 5.1.

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.

Syntax:

OLD_PASSWORD(string);

Argument:

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

Syntax Diagram:

MySQL OLD_PASSWORD() Function - Syntax Diagram

MySQL Version: 5.6


Example:

Code:

SELECT OLD_PASSWORD('w3resource');

Explanation:

The above MySQL statement encrypts the plain text string w3resource and returns a binary string 4e8fd7b041ff73bf.

Sample Output:

mysql> SELECT OLD_PASSWORD('w3resource');
+----------------------------+
| OLD_PASSWORD('w3resource') |
+----------------------------+
| 4e8fd7b041ff73bf           | 
+----------------------------+
1 row in set (0.00 sec)

Previous: MD5()
Next: PASSWORD()