简体   繁体   中英

Maximum MySQL user password length

What is the maximum length for a MySQL user password?

MySQL uses PASSWORD(str) to encrypt the cleartext password str . This hashed password string is stored in the mysql.user grant table with a CHAR(41) datatype.

However, I was not able to find what is the maximum length for the cleartext password str , if there is one. Can anyone help?

This is the reference pages I found when I googled : Link1 and Link2

If you are using MySQL Replication, be aware that, currently, a password used by a replication slave as part of a CHANGE MASTER TO statement is effectively limited to 32 characters in length; if the password is longer, any excess characters are truncated. This is not due to any limit imposed by the MySQL Server generally, but rather is an issue specific to MySQL Replication. (For more information, see Bug 43439 .)

Fix documented in the 5.7.5 changelog , as follows:

The maximum length that can be used for the password in a CHANGE MASTER TO statement is 32 characters. Previously, when a longer password was employed, any excess length was silently truncated by the server. Now when the password's length exceeds 32 characters, CHANGE MASTER TO fails with an error.

So I would safely assume my password should not be more than 32 characters.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM