diff --git a/functions-and-operators/encryption-and-compression-functions.md b/functions-and-operators/encryption-and-compression-functions.md index 1bb01cfda4b46..386d1cee2bdc7 100644 --- a/functions-and-operators/encryption-and-compression-functions.md +++ b/functions-and-operators/encryption-and-compression-functions.md @@ -16,7 +16,6 @@ TiDB supports most of the [encryption and compression functions](https://dev.mys | [`AES_ENCRYPT()`](#aes_encrypt) | Encrypt using AES | | [`COMPRESS()`](#compress) | Compress and return result as a binary string | | [`MD5()`](#md5) | Calculate MD5 checksum | -| [`PASSWORD()`](#password) | Calculate and return a password string | | [`RANDOM_BYTES()`](#random_bytes) | Return a random byte vector | | [`SHA()`](#sha) | Calculate an SHA-1 160-bit checksum | | [`SHA1()`](#sha1) | Calculate an SHA-1 160-bit checksum | @@ -139,29 +138,6 @@ SELECT MD5('abc'); 1 row in set (0.00 sec) ``` -### [`PASSWORD()`](https://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html#function_password) - -> **Warning:** -> -> This function is deprecated in MySQL 5.7 and removed in MySQL 8.0. It is deprecated in TiDB. It is not recommended to use this function. - -The `PASSWORD(str)` function calculates a password hash that can be used with the `mysql_native_password` authentication method. - -```sql -SELECT PASSWORD('secret'); -``` - -``` -+-------------------------------------------+ -| PASSWORD('secret') | -+-------------------------------------------+ -| *14E65567ABDB5135D0CFD9A70B3032C179A49EE7 | -+-------------------------------------------+ -1 row in set, 1 warning (0.00 sec) - -Warning (Code 1681): PASSWORD is deprecated and will be removed in a future release. -``` - ### [`RANDOM_BYTES()`](https://dev.mysql.com/doc/refman/8.0/en/encryption-functions.html#function_random-bytes) The `RANDOM_BYTES(n)` function returns `n` random bytes. @@ -426,4 +402,4 @@ Examples: * TiDB does not support the `STATEMENT_DIGEST()` and `STATEMENT_DIGEST_TEXT()` functions. * TiDB does not support the `kdf_name`, `salt`, and `iterations` arguments for [`AES_ENCRYPT()`](#aes_encrypt) and [`AES_DECRYPT`](#aes_decrypt) that MySQL added in MySQL 8.0.30. -* MySQL does not implement the [`SM3()`](#sm3) function. \ No newline at end of file +* MySQL does not implement the [`SM3()`](#sm3) function. diff --git a/sql-statements/sql-statement-set-password.md b/sql-statements/sql-statement-set-password.md index 2d3ae1e3b6e2e..4bd8de7e024f0 100644 --- a/sql-statements/sql-statement-set-password.md +++ b/sql-statements/sql-statement-set-password.md @@ -8,11 +8,19 @@ aliases: ['/docs/dev/sql-statements/sql-statement-set-password/','/docs/dev/refe This statement changes the user password for a user account in the TiDB system database. +> **Note:** +> +> It is recommended to change the password by using the [`ALTER USER`](/sql-statements/sql-statement-alter-user.md) statement as follows: +> +> ```sql +> ALTER USER myuser IDENTIFIED BY 'mypassword'; +> ``` + ## Synopsis ```ebnf+diagram SetPasswordStmt ::= - "SET" "PASSWORD" ( "FOR" Username )? "=" ( stringLit | "PASSWORD" "(" stringLit ")" ) + "SET" "PASSWORD" ( "FOR" Username )? "=" stringLit ``` ## Examples @@ -35,17 +43,6 @@ mysql> SHOW CREATE USER 'newuser'; mysql> SET PASSWORD FOR newuser = 'test'; Query OK, 0 rows affected (0.01 sec) -mysql> SHOW CREATE USER 'newuser'; -+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| CREATE USER for newuser@% | -+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| CREATE USER 'newuser'@'%' IDENTIFIED WITH 'mysql_native_password' AS '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK | -+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -1 row in set (0.00 sec) - -mysql> SET PASSWORD FOR newuser = PASSWORD('test'); -- deprecated syntax from earlier MySQL releases -Query OK, 0 rows affected (0.00 sec) - mysql> SHOW CREATE USER 'newuser'; +----------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | CREATE USER for newuser@% |