All pages
Powered by GitBook
1 of 1

Loading...

PASSWORD

Calculate password hash. This function calculates a password hash string for a plaintext password.

Syntax

PASSWORD(str)

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 if the argument is NULL.

The return value is a nonbinary string in the connection , determined by the values of the and system variables.

This is the function that is used for hashing MariaDB passwords for storage in the Password column of the (see ), usually used with the statement. It is not intended for use in other applications.

The function takes into account the authentication plugin where applicable (a or statement). For example, when used in conjunction with a user authenticated by the , the statement will create a longer hash:

The behavior of this function is affected by the value of the system variable. If this is set to 1 (0 is default), MariaDB reverts to using the by default for newly created users and passwords.

Examples

See Also

  • - permits the setting of basic criteria for passwords

  • - pre-MySQL 4.1 password function

This page is licensed: GPLv2, originally from

character set and collation
character_set_connection
collation_connection
user table
privileges
SET PASSWORD
CREATE USER
SET PASSWORD
ed25519 plugin
old_passwords
mysql_old_password authentication plugin
Password Validation Plugins
OLD_PASSWORD()
fill_help_tables.sql
CREATE USER edtest@localhost IDENTIFIED VIA ed25519 USING PASSWORD('secret');

CREATE USER edtest2@localhost IDENTIFIED BY 'secret';

SELECT CONCAT(user, '@', host, ' => ', JSON_DETAILED(priv)) FROM mysql.global_priv
  WHERE user LIKE 'edtest%'\G
*************************** 1. row ***************************
CONCAT(user, '@', host, ' => ', JSON_DETAILED(priv)): edtest@localhost => {
...
    "plugin": "ed25519",
    "authentication_string": "ZIgUREUg5PVgQ6LskhXmO+eZLS0nC8be6HPjYWR4YJY",
...
}
*************************** 2. row ***************************
CONCAT(user, '@', host, ' => ', JSON_DETAILED(priv)): edtest2@localhost => {
...
    "plugin": "mysql_native_password",
    "authentication_string": "*14E65567ABDB5135D0CFD9A70B3032C179A49EE7",
...
}
SELECT PASSWORD('notagoodpwd');
+-------------------------------------------+
| PASSWORD('notagoodpwd')                   |
+-------------------------------------------+
| *3A70EE9FC6594F88CE9E959CD51C5A1C002DC937 |
+-------------------------------------------+
SET PASSWORD FOR 'bob'@'%.loc.gov' = PASSWORD('newpass');