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: 8.0


Example:

Code:

SELECT OLD_PASSWORD('w3resource');

Explanation:

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

Output:

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

Previous: MD5()
Next: PASSWORD()



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/mysql/encryption-and-compression-functions/old_password%28%29.php