PASSWORD
Syntax
PASSWORD(str)
Contents
Description
The PASSWORD() function is used for hashing passwords for use in authentication by the MariaDB server. It is not intended for use in other applications.
Calculates and returns a hashed password string from the plaintext password str. Returns an empty string (>= MariaDB 10.0.4) or NULL (<= MariaDB 10.0.3) if the argument was NULL.
As of MariaDB 5.5, the return value is a nonbinary string in the connection character set and collation, determined by the values of the character_set_connection and collation_connection system variables. Before 5.5, the return value was a binary string.
The return value is 41-bytes in length, and the first character is always '*'.
This is the function that is used for hashing MariaDB passwords for storage in the Password column of the user table (see privileges), usually used with the SET PASSWORD statement. It is not intended for use in other applications.
The behavior of this function depends on the value of the old_passwords
system variable.
Examples
SELECT PASSWORD('notagoodpwd'); +-------------------------------------------+ | PASSWORD('notagoodpwd') | +-------------------------------------------+ | *3A70EE9FC6594F88CE9E959CD51C5A1C002DC937 | +-------------------------------------------+
SET PASSWORD FOR 'bob'@'%.loc.gov' = PASSWORD('newpass');
See Also
- Password Validation Plugins - permits the setting of basic criteria for passwords
- OLD_PASSWORD() - pre-MySQL 4.1 password function