totn MariaDB Functions

MariaDB: PASSWORD Function

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

Description

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

Syntax

The syntax for the PASSWORD function in MariaDB is:

PASSWORD( string )

Parameters or Arguments

string
A plaintext password string that is the source to create an encrypted/hashed password in MariaDB.

Note

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

Applies To

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

  • MariaDB 10

Example

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

For example:

SELECT PASSWORD('TechOnTheNet.com');
Result: '*BAC7C920F2507B848358495F25F1B509C0C5C279'

SELECT PASSWORD('123456789');
Result: '*CC67043C7BCFF5EEA5566BD9B1F3C74FD9A5CF5D'

SELECT PASSWORD('password');
Result: '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19'

SELECT PASSWORD(NULL);
Result: NULL