MariaDB
MariaDB DML
二. Authentication Options
IDENTIFIED BY ‘password’
The optional INDENTIFIED BY clause can be used to provide an account with a password.The password should be specified in plain text. It will be hashed by the PASSWORD function prior to being stored to the mysql.user table.
例如,如果密码为mariadb,之后我们创建一个用户
CREATE USER foo2@test IDENTIFIED BY 'mariadb';
IDENTIFIED BY PASSWORD 'password_hash'
SELECT PASSWORD('mariadb'); +-------------------------------------------+ | PASSWORD('mariadb') | +-------------------------------------------+ | *54958E764CE10E50764C2EECBB71D01F08549980 | +-------------------------------------------+ 1 row in set (0.00 sec)
之后尝试创建一个用户使用哈希值
CREATE USER foo2@test IDENTIFIED BY PASSWORD '*54958E764CE10E50764C2EECBB71D01F08549980';