Bug #7789 Long User Name Gets Truncated
Submitted: 11 Jan 2005 0:44 Modified: 11 Jan 2005 6:13
Reporter: Roger Wyatt Email Updates:
Status: Not a Bug Impact on me:
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:3.51 OS:Microsoft Windows (Windows XP)
Assigned to: CPU Architecture:Any

[11 Jan 2005 0:44] Roger Wyatt
If you have a user name that exceeds 16 characters it gets is truncated. It will not connect to the database and throws and exception.

Here is the exception from Debug (username and IP changed).

System.Data.Odbc.OdbcException: ERROR [HYT00] [MySQL][ODBC 3.51 Driver]Access denied for user: 'XXX.XXXXXXX.XXXX@99.999.999.999' (Using password: YES)

Using VB.NET

The ODBC setup in Windows accepts a long user name, it is only truncated at run time. If you use the UID= parameter of the connection string property it is still truncated

How to repeat:
Create a MySQL user with a long (greater than 16 characters) user name. Attempt to connect through ODBC with that user. Use either the DSN= parameter with the long user name or with the UID= parameter of the connection string.

Suggested fix:
Increase the length of the user id value passed to the DLL.  UNIX system can have long names and in my case, I use a shared host and they assign the user name which makes the simple fix of "just create a shorter user name".
[11 Jan 2005 6:13] Jorge del Conde
MySQL Usernames should be <= 16 characters.  You can verify this by looking at the User column in mysql.user:

User varchar(16)
[12 Mar 2005 19:53] Lilian Rudenco
In mysql 4.0.22 I modified column lenght and it's working
but in version 4.1.10 this not working.
ALTER TABLE mysql.db MODIFY User CHAR(32);
ALTER TABLE mysql.user MODIFY User CHAR(32);

is there a way to accept long username in latest version of mysql ?
[28 Feb 2011 7:51] jai kumar
It would be helpful if we have this patch for mysql 5.5. I also tried to apply this patch on 5.1.55 and got the below error. 

[jkamaraj@tets-pc mysql-5.1]$ patch -p1 < patch1 
patching file config/ac-macros/misc.m4
Hunk #1 succeeded at 621 with fuzz 1 (offset -93 lines).
patching file configure.in
Hunk #1 FAILED at 2383.
1 out of 1 hunk FAILED -- saving rejects to file configure.in.rej
patching file include/mysql_com.h
Hunk #1 FAILED at 23.
1 out of 1 hunk FAILED -- saving rejects to file include/mysql_com.h.rej
patching file netware/init_db.sql
Reversed (or previously applied) patch detected!  Assume -R? [n]

Please let me know the source location which you have used here.