totn MariaDB Functions

MariaDB: OLD_PASSWORD Function

This MariaDB tutorial explains how to use the MariaDB OLD_PASSWORD function with syntax and examples.

Description

The MariaDB OLD_PASSWORD function is used by the authentication system to generate a hashed password from a plaintext password string, using older hashing techniques. To use newer hashing techniques, use the PASSWORD function.

Syntax

The syntax for the OLD_PASSWORD function in MariaDB is:

OLD_PASSWORD( string )

Parameters or Arguments

string
A plaintext password string that is the source to create an encrypted/hashed password in MariaDB, using older hashing techniques.

Note

  • The OLD_PASSWORD function will return NULL, if the string is NULL.
  • The OLD_PASSWORD function is used by the authentication system in MariaDB to store passwords.
  • Do not use th OLD_PASSWORD function in your own application, use the MD5 or SHA1 functions instead.
  • See also the ENCRYPT function.

Applies To

The OLD_PASSWORD function can be used in the following versions of MariaDB:

  • MariaDB 10

Example

Let's look at some MariaDB OLD_PASSWORD function examples and explore how to use the OLD_PASSWORD function in MariaDB.

For example:

SELECT OLD_PASSWORD('TechOnTheNet.com');
Result: '0982897c76beeec1'

SELECT OLD_PASSWORD('123456789');
Result: '0c95234760ae5a28'

SELECT OLD_PASSWORD('password');
Result: '5d2e19393cc5ef67'

SELECT OLD_PASSWORD(NULL);
Result: NULL