Bug #448 Cannot grant to user named grant
Submitted: 18 May 2003 11:29 Modified: 18 May 2003 21:59
Reporter: Bruce Lawton Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.0.12 OS:MacOS (Mac OS X, 10.2.6, probably any)
Assigned to: CPU Architecture:Any

[18 May 2003 11:29] Bruce Lawton
Description:
The parsing of the grant command seems to trip up when the name of the new user just happens 
to be "grant". It results in an error 1046. The workaround is to pick a different name, leaving the 
command otherwise identical. The person I need to set up is named Grant.

How to repeat:
See that this fails (using your own database and passwords):

./mysql -h localhost -u root -pmyRootPasswordHere -e "grant all on myOwnDB.* to 
grant@localhost identified by 'hisNewPasswordHere' with grant option;"

and this works:

./mysql -h localhost -u root -pmyRootPasswordHere -e "grant all on myOwnDB.* to 
jgrant@localhost identified by 'hisNewPasswordHere' with grant option;"
[18 May 2003 21:59] Alexander Keremidarski
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

GRANT is reserved word. In order to be used as a name reserved word has to be quoted by backticks.

GRANT ... TO `grant`@`localhost` ...; 

Same applies to all reserved words. http://www.mysql.com/doc/en/Reserved_words.html