Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 248
Chris Avatar asked Sep 18 '11 23:09

Chris


People also ask

How long is MySQL password?

Passwords must be at least 8 characters long. To change this length, modify validate_password. length . MEDIUM policy adds the conditions that passwords must contain at least 1 numeric character, 1 lowercase character, 1 uppercase character, and 1 special (nonalphanumeric) character.

Is there a limit to password length?

The maximum length of a password that a human user could actually type to log into Windows in 127 characters (the limitation is in the Windows GUI).

Do MySQL passwords expire?

MySQL enables database administrators to expire account passwords manually, and to establish a policy for automatic password expiration.


2 Answers

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.

like image 70
georgecj11 Avatar answered Sep 21 '22 03:09

georgecj11


This may not fully answer "what is maximum MySQL pwd length...", but I can tell you my recent findings.

-- installing in Windows 10: "Server version: 8.0.24 MySQL Community Server - GPL "

-- Server, Workbench, documentation, all installed without error.

-- Post-install could not connect as root, getting "Access denied for user 'root'@'localhost' (using password yes)", as well as CLI would close immediately after entering password and pressing Enter.

-- Tried several solutions from web, then it occurred to me it may be root password, my understanding was it is 32 characters max.

-- Maybe it's not max 32 characters. On the 4th install attempt, only change was I replaced the 32 character root password with a new 30 character password, and it all works now. No other changes in the install process.

-- If it really is 32 characters max, then maybe there is truncation occurring, or maybe MySQL was not happy with one or more of the 32 characters in original root password, but then again, test connection worked and no errors during install.

like image 25
daktari Avatar answered Sep 23 '22 03:09

daktari