Bug #1005 The host or user argument to GRANT is too long
Submitted: 5 Aug 2003 12:48 Modified: 6 Aug 2003 8:06
Reporter: Dave Ellenberger Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Embedded Library ( libmysqld ) Severity:S3 (Non-critical)
Version:4.0.14 OS:Linux (Debian Linux)
Assigned to: Sergei Golubchik CPU Architecture:Any

[5 Aug 2003 12:48] Dave Ellenberger
Description:
Hi,

mysql> GRANT ALL PRIVILEGES ON test.* TO 'dave@192.168.0.0/255.255.255.192' IDENTIFIED BY '123';
ERROR 1145: The host or user argument to GRANT is too long

The user.Host field defaults to VARCHAR(60).
The user.User field defaults to VARCHAR(16).
So my syntax should be working...?

I can setup the user by entering:
INSERT INTO user VALUES('192.168.0.0/255.255.255.192', 'dave'... etc
... and it works.

-Dave

How to repeat:
mysql> GRANT ALL PRIVILEGES ON test.* TO 'dave@192.168.0.0/255.255.255.192' IDENTIFIED BY '123';

Suggested fix:
Setup the MySQL login by using INSERT INTO user/db VALUES(x,y,z).
[6 Aug 2003 5:01] MySQL Verification Team
For a set of hosts use a wildcard.

Also, use only GRANT / REVOKE.
[6 Aug 2003 6:32] Sergei Golubchik
hmm, I think we'll look into it, still
[6 Aug 2003 8:06] Sergei Golubchik
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem is not the result of a bug.
For a list of more appropriate places to ask for help using MySQL
products, please visit http://www.mysql.com/support/

Thank you for your interest in MySQL.

Ok, this is not a bug.

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 'dave@192.168.0.0/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';