MariaDB Tutorial MariaDB Advanced MariaDB Database Account Management MariaDB References

MariaDB PASSWORD() Function



The MariaDB PASSWORD() function is used by the authentication system in MariaDB to generate a hashed password from a plaintext password string. It uses more powerful hashing as compared to older hashing techniques. To use older hashing techniques, OLD_PASSWORD() function can be used.

The PASSWORD() function returns the encrypted/hashed string, or NULL if the string is NULL.

The PASSWORD() function performs one-way encryption. This function is used by the authentication system in MariaDB to store passwords.

Syntax

PASSWORD(string)

Parameters

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

Return Value

Returns the encrypted/hashed password string.

Example:

The example below shows the usage of PASSWORD() function.

SELECT PASSWORD('xyz');
Result: '*39C549BDECFBA8AFC3CE6B948C9359A0ECE08DE2'

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

SELECT PASSWORD('alphacodingskills');
Result: '*3CAF4FC498E7B7D0F274A6B22CC7A8149F3703E5'

SELECT PASSWORD(123);
Result: '*23AE809DDACAF96AF0FD78ED04B6A265E05AA257'

SELECT PASSWORD(NULL);
Result: NULL

❮ MariaDB Functions