如何修改数据库密码

mysql> create user ‘test’@‘localhost’ identified by ‘123456’;
Query OK, 0 rows affected (0.02 sec)

mysql> select User,authentication_string from mysql.user where user=‘test’;
±-----±------------------------------------------+
| User | authentication_string |
±-----±------------------------------------------+
| test | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
±-----±------------------------------------------+
1 row in set (0.00 sec)

mysql> ALTER USER ‘test’@‘localhost’ IDENTIFIED WITH mysql_native_password AS ‘111111’;
ERROR 1827 (HY000): The password hash doesn’t have the expected format. Check if the correct password algorithm is being used with the PASSWORD() funct
ion.mysql> ALTER USER ‘test’@‘localhost’ IDENTIFIED WITH mysql_native_password AS ‘*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9’;
Query OK, 0 rows affected (0.04 sec)

mysql> show variables like ‘default_authentication_plugin’;
±------------------------------±----------------------+
| Variable_name | Value |
±------------------------------±----------------------+
| default_authentication_plugin | mysql_native_password |
±------------------------------±----------------------+
1 row in set (0.00 sec)

mysql> select version();
±-------------------+
| version() |
±-------------------+
| 8.0.11-TiDB-v7.5.0 |
±-------------------+
1 row in set (0.00 sec)