List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:March 10 2003 4:41pm
Subject:Re: ---> Username size limitations
View as plain text  
At 14:35 +0100 3/10/03, Chand wrote:
>hey dudes, i'd really need some insight on this. Does anyone have 
>any idea about this ?
>I have a quick and painless (i hope :) )question..
>Do you know how the username length is limited under MySQL. There is 
>no mention of this in the manual or books. I figured the username 
>length was dynamically limited by the length of the User field in 
>the mysql.user table.

The length is described in the manual in this section:

It indicates that usernames are stored in a 16-character column.
You can also issue a DESCRIBE mysql.user statement to find out.

>But i have users with Username longer than 32 characters and those 
>get an Access denied error. And, say the username is 
>"supercalifragilistixexpicalidocious" (36 characters) it tells that 
>user "supercalifragilistixexpicalidoci@.." can't login.  I have then 
>changed the user field length in the mysql.user table to 128. But 
>still, can't login.
>I've looked into the code. First thing, the username is cropped at 
>32 characters in the error message itself. Indeed, in errmsg.txt, 
>the access denied error format string is :
>"Access denied for user: '%-.32s@%-.64s' to database '%-.64s'"
>I haven't tried recompiling with a longer username string 
>conversion, but if you guys tell me MySQL is not cropping the 
>username before matching it against the privilege table, i will to 
>be sure. I have looked at the user authentication code and haven't 
>found anything that would seem to crop at 32 characters even though 
>i have found a constant name USERNAME_LENGTH fixed at 16 
>characters..which would have been coherent if it was fixed at 32 .. 
>so i don'treally know what to believe.
>Can anyone tell me exactly what happens ? Is mysql really hard 
>limiting the username to 32 characters ? I don't think i have a 
>hostname issue since from a same machine, another login with the 
>exact same user privilege except the username length works..
>If mysql crops the username, is there a patch against it ? If 
>someone can point me where in the code this is handled i could do 
>the patch myself, just need a hint as to where to find the stuff :) 
>I have merely overlooked the code to find obvious proff mysql was 
>doing this but didn't.
>any insight would be greatly appreciated.
>Thank guys

---> Username size limitationsChand10 Mar
  • Re: ---> Username size limitationsPaul DuBois10 Mar
    • Re: ---> Username size limitationsChand10 Mar