[mysql] Username length problems

Daredevil

Verified User
Joined
Oct 24, 2004
Messages
51
Location
Netherlands
I keep stumbling on the

"Unable to add user xxxx. The host or user argument to GRANT is too long"

problems. And frankly their starting to annoy me, is there anyway to hard-code the checking of the mysql usernames out of DA ?

I've tried setting length of the actual field to 32 instead of it's standard 16 but that doesn't seem to be working :(.


Anyone got any tips ? Other then shortning my DA usernames ofcourse :P
 
Mysql username length settings are different and since the username of DA is added to the beginning of the mysql username, if you have a long username in DA it will pass the max length of the mysql username.

You can change the length setting of the mysql usernames by logging into MySQL as da_admin and modifying the user table in the mysql database. Change the Type of the column user and change it from varchar(16) to a new bigger value.
 
Ah,
Then I'm not exactly sure what is causing that message but just check all of the tables in the mysql database since 3 or 4 have the same 16 character limit which could be one of those.

It could possibly be the user column in the db table. Just check them all, its in there somewhere. I dont' think the grant length is hardcoded into mysql.
Exactly how long is this username your trying to add? Its also possible its not one of the user columns it could be the host columns (60)......

I also found this on the mysql bug list which was denied it is not a bug, DA might not be doing it the way its supposed to.
According to the manual, you have to quote username and hostname separately:

GRANT ... TO 'user'@host'

The way you did it:

GRANT ... TO 'user@host'

means grant to username='user@host', hostname='%',
and '[email protected]/255.255.255.192' is too long for a username.

You need to write

mysql> GRANT ALL PRIVILEGES ON test.* TO 'dave'@'192.168.0.0/255.255.255.192'
IDENTIFIED BY '123';
 
Last edited:
I've check all the column that could, in any way, affect the lenght of the username and changed them so far still nothing.
 
Hello,

I'm not sure the quotes would change anything. The user column in the mysql.user table is still only 16 characters long. That means that "username_dbuser" has to be 16 or less characters long.

Also, this was on their site:
For the moment, GRANT only supports host, table, database, and column names up to 60 characters long. A username can be up to 16 characters.
http://dev.mysql.com/doc/mysql/en/GRANT.html

John
 
this is still the case I suppose.. Is there some way to change this limit?

When I have a user with 8 characters then the underscore _ there remains only 5 characters for the database name.
 
Daredevil said:
I keep stumbling on the

"Unable to add user xxxx. The host or user argument to GRANT is too long"

problems. And frankly their starting to annoy me, is there anyway to hard-code the checking of the mysql usernames out of DA ?

I've tried setting length of the actual field to 32 instead of it's standard 16 but that doesn't seem to be working :(.


Anyone got any tips ? Other then shortning my DA usernames ofcourse :P

I tried that, restarted mysql and no one could connect to the database anymore - running centOS 4.4 64bit with mysql 5.0.19

My mysql.user table is CHAR, not VARCHAR

I managed to put the database back to original by:
/sbin/service mysqld stop
/usr/bin/mysqld_safe --skip-grant-tables

Then logging into phpmyadmin using normal da_admin password, and setting it back to CHAR(16) instead of CHAR(32)

just incase someone else runs into the same problem.
 
Back
Top