471,073 Members | 1,367 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,073 software developers and data experts.

More on a bug in MySQL 3.23.58

This may be old news, but it's kinda frustrating and I wonder if
Something Can Be Done:
mysql> grant all on *.* to 'jeff_dev@localhost' identified by
'my^son^daniel';
ERROR 1145: The host or user argument to GRANT is too long
mysql> grant all on *.* to 'q_dev@localhost' identified by
'my^son^daniel';
Query OK, 0 rows affected (0.00 sec)

If memory serves me, a host name in the DNS system can be 255
characters altogether. If you assume that a UNIX username is 8
characters (I know, I know, UNIX usernames have nothing to do with
MySQL usernames), that means that a MySQL username must be at least
264 chars long, and if you assume that the user name will have a
string such as _dev _test _prod, etc., appended then 270 chars is more
reasonable from a user point of view.

Or is there another solution that eludes me?

Many thanks,
Jeff
Jul 20 '05 #1
4 1735
Jeff Silverman wrote:
This may be old news, but it's kinda frustrating and I wonder if
Something Can Be Done:
mysql> grant all on *.* to 'jeff_dev@localhost' identified by
'my^son^daniel';
ERROR 1145: The host or user argument to GRANT is too long
mysql> grant all on *.* to 'q_dev@localhost' identified by
'my^son^daniel';
Query OK, 0 rows affected (0.00 sec)

If memory serves me, a host name in the DNS system can be 255
characters altogether. If you assume that a UNIX username is 8
characters (I know, I know, UNIX usernames have nothing to do with
MySQL usernames), that means that a MySQL username must be at least
264 chars long, and if you assume that the user name will have a
string such as _dev _test _prod, etc., appended then 270 chars is more
reasonable from a user point of view.

Or is there another solution that eludes me?

Many thanks,
Jeff

Am I missing something here?

Although a host name CAN be 255 characters long, who in their right mind
will use one of that length?
Jul 20 '05 #2
Jeff Silverman wrote:
mysql> grant all on *.* to 'jeff_dev@localhost' ...
ERROR 1145: The host or user argument to GRANT is too long


Look at the table 'user' in the 'mysql' database. The user field is 16
characters, and the host field is 60 characters. So there should be
enough storage available for 'jeff_dev' as the user, and 'localhost' as
the host.

However, by putting the entire 'user@host' string in quotes, you're
telling MySQL that it's all the username, and that you aren't using the
(optional) host specification. You're trying to fit the 18-character
string 'jeff_dev@localhost' into a 16-character field.

The syntax examples I see in the MySQL manual show quoting the user and
host portions individually. So try this:

grant all on *.* to 'jeff_dev'@'localhost' ...

Also read the following excerpt from
http://mysql.he.net/doc/mysql/en/GRANT.html:

In order to accommodate granting rights to users from arbitrary hosts,
MySQL supports specifying the user value in the form
user_name@host_name. If you want to specify a user_name string
containing special characters (such as `-'), or a host_name string
containing special characters or wildcard characters (such as `%'), you
can quote the username or hostname (for example,
'test-user'@'test-hostname'). Quote the username and hostname separately.

You can specify wildcards in the hostname. For example,
user_name@'%.loc.gov' applies to user_name for any host in the loc.gov
domain, and user_name@'144.155.166.%' applies to user_name for any host
in the 144.155.166 class C subnet.

The simple form user_name is a synonym for user_name@'%'.

Regards,
Bill K.
Jul 20 '05 #3
2metre <2m****@xxxhersham.net> wrote in message news:<ck**********@sparta.btinternet.com>...
Jeff Silverman wrote:

....

If memory serves me, a host name in the DNS system can be 255
characters altogether. ....
Many thanks,
Jeff

Am I missing something here?

Although a host name CAN be 255 characters long, who in their right mind
will use one of that length?


I should have written "a fully qualified domain name (FQDN)" instead
of host name. Refer to http://en.wikipedia.org/wiki/FQDN and also
RFCs 1035 and 1123. The reason it becomes an issue is if you have lots
of subdomains, e.g.

mylittlehost.mylittlegroup.mygroup.myorg.mysubdivi sion.mydivision.mycompany.myholdingcompany.com

I agree with the thrust of your comment, however. Just because you
*can* do something, doesn't necessarily mean you *should* do that
thing. On the other hand, if *can* do something, then whatever
solution for any other problem that relates to the thing ought to
support that thing. So while 255 character FQDNs are a dumb thing to
do, that's what the RFC says is allowed, so anything that uses
hostnames should support 255 character FQDNs.
Jeff
Jul 20 '05 #4
Thank you.
Jeff
Bill Karwin <bi**@karwin.com> wrote in message news:<ck********@enews1.newsguy.com>...
Jeff Silverman wrote:
mysql> grant all on *.* to 'jeff_dev@localhost' ...
ERROR 1145: The host or user argument to GRANT is too long


Look at the table 'user' in the 'mysql' database. The user field is 16
characters, and the host field is 60 characters. So there should be
enough storage available for 'jeff_dev' as the user, and 'localhost' as
the host.

However, by putting the entire 'user@host' string in quotes, you're
telling MySQL that it's all the username, and that you aren't using the
(optional) host specification. You're trying to fit the 18-character
string 'jeff_dev@localhost' into a 16-character field.

The syntax examples I see in the MySQL manual show quoting the user and
host portions individually. So try this:

grant all on *.* to 'jeff_dev'@'localhost' ...

Also read the following excerpt from
http://mysql.he.net/doc/mysql/en/GRANT.html:

In order to accommodate granting rights to users from arbitrary hosts,
MySQL supports specifying the user value in the form
user_name@host_name. If you want to specify a user_name string
containing special characters (such as `-'), or a host_name string
containing special characters or wildcard characters (such as `%'), you
can quote the username or hostname (for example,
'test-user'@'test-hostname'). Quote the username and hostname separately.

You can specify wildcards in the hostname. For example,
user_name@'%.loc.gov' applies to user_name for any host in the loc.gov
domain, and user_name@'144.155.166.%' applies to user_name for any host
in the 144.155.166 class C subnet.

The simple form user_name is a synonym for user_name@'%'.

Regards,
Bill K.

Jul 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Krasimir_Slaveykov | last post: by
reply views Thread by Degan, George E, JR, MGSVC | last post: by
reply views Thread by Karam Chand | last post: by
4 posts views Thread by mikey | last post: by
reply views Thread by Google Mike | last post: by
2 posts views Thread by Gnurp Gnarp | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.