Support RETAIN CURRENT PASSWORD aka dual passwords
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Feature Request
**Is your feature request related to a problem? Please describe:**
MySQL 8.0 supports two passwords per user. This is helpful for password rotation, since it's not usually possible to atomically make a change and have it apply across all hosts that connect to the database.
**Describe the feature you'd like:**
```
mysql> ALTER USER u1 IDENTIFIED WITH 'mysql_native_password' AS '*B50FBDB37F1256824274912F2A1CE648082C3F1F' RETAIN CURRENT PASSWORD;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 107 near "RETAIN CURRENT PASSWORD"
mysql> select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v9.0.0-beta.1.pre-422-g3ccc5aa001
Edition: Community
Git Commit Hash: 3ccc5aa001ec485b1219ea9df9c7e0b3dde4f995
Git Branch: HEAD
UTC Build Time: 2025-03-14 20:26:34
GoVersion: go1.23.7
Race Enabled: false
Check Table Before Drop: false
Store: tikv
1 row in set (0.00 sec)
```
Vs MySQL:
```
mysql> ALTER USER u1 IDENTIFIED WITH 'mysql_native_password' AS '*B50FBDB37F1256824274912F2A1CE648082C3F1F' RETAIN CURRENT PASSWORD;
Query OK, 0 rows affected (0.01 sec)
mysql> SELECT version();
+-----------+
| version() |
+-----------+
| 8.0.32 |
+-----------+
1 row in set (0.00 sec)
```
**Describe alternatives you've considered:**
For my use case I am primary concerned with parser support, but this is a useful feature.
**Teachability, Documentation, Adoption, Migration Strategy:**
Contributor guide
Assessment
This issue has not been assessed yet.