Bug #3124 Grant all problems with dashes
Submitted: 9 Mar 2004 14:20 Modified: 9 Mar 2004 14:27
Reporter: Donny Simonton Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1.1 OS:Linux (Linux)
Assigned to: Dean Ellis CPU Architecture:Any

[9 Mar 2004 14:20] Donny Simonton
Description:
When a server name has a - in the name, the grant all command fails.
mysql> GRANT ALL PRIVILEGES ON Iris.* TO iris@dc-mail1.domainagogo.com IDENTIFIED BY "irissucks";
ERROR 1064 (42000): You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near '-mail1.domaincontender.com IDENTIFIED BY "irissucks"' at line 1

If you remove the - it works fine.
mysql> GRANT ALL PRIVILEGES ON Iris.* TO iris@localhost.com IDENTIFIED BY "irissucks";
Query OK, 0 rows affected (0.00 sec)

How to repeat:
Run above grant statements

Suggested fix:
Fix dash problem.
[9 Mar 2004 14:27] Dean Ellis
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Additional info:

You must quote such names, as documented in the manual.  See:

http://www.mysql.com/doc/en/GRANT.html