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.