pingcap / pingcap/tidb

Remove deprecated PASSWORD() function

Open
#58,341 3 comments 1 reaction 0 assignees View on GitHub
compatibility-mysql80 type/compatibility
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Description

> This function is deprecated in MySQL 5.7 and is removed in MySQL 8.0.

Should we rename it to `password` or just remove it?

I found it included by https://github.com/pingcap/tidb/pull/2680, @XuHuaiyu PTAL

_Originally posted by @Defined2014 in https://github.com/pingcap/tidb/issues/58312#issuecomment-2547313732_

The `PASSWORD()` function was used in MySQL 5.7 and before to create passwords for `mysql_native_password` and `sha256_password`. And at some point before MySQL 5.7 it also supported pre-4.1 authentication.

Reasons for removal:
- MySQL 8.0 removes it
- The `PASSWORD()` function doesn't work for `caching_sha2_password`
- Using the `PASSWORD()` function to directly update the `mysql.user` would circumvent password rules.
- Using the `PASSWORD()` function to create a hash which then gets used in `... IDENTIFIED AS ...` might also circumvent password rules.

This seem to have been deprecated since TiDB version v2.0.0-rc.3

## Related

- https://dev.mysql.com/worklog/task/?id=10774
- https://github.com/pingcap/tidb/issues/58312
- https://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html#function_password
- https://docs.pingcap.com/tidb/stable/security-compatibility-with-mysql#authentication-plugin-status
- https://github.com/pingcap/tidb/pull/6000
- https://github.com/pingcap/tidb/issues/5946
- https://github.com/pingcap/docs/pull/19731

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.