Bug #15662 GRANT RELOAD fails from MyODBC; works from CLI
Submitted: 11 Dec 2005 8:11 Modified: 11 Jul 2007 21:17
Reporter: Matthew Kerr Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:3.51.12 OS:Windows (Win XP)
Assigned to: CPU Architecture:Any

[11 Dec 2005 8:11] Matthew Kerr
Description:
I am setting up a UI to grant/revoke permissions to other users.

When I attempt to "GRANT RELOAD ON * TO 'admin'@'%' WITH GRANT OPTION" via ODBC, it gives a syntax error (not a permissions error).

When I copy and paste the statement to the CLI, it runs fine.

All of my other grant statements work just fine.

How to repeat:
From CLI:
----------
mysql> GRANT RELOAD ON * TO 'admin'@'%' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

From SQL Trace:
------------------
WCHAR *             0x0013DDF0 [      -3] "GRANT RELOAD ON * TO 'admin'@'%' WITH GRANT OPTION\ 0"
[...]
DIAG [S1T00] [MySQL][ODBC 3.51 Driver][mysqld-4.1.15-nt]Incorrect usage of DB GRANT and GLOBAL PRIVILEGES (1221) 

Again, all other grant statements work fine.

Suggested fix:
Make GRANT RELOAD work via ODBC just like via the CLI.
[11 Dec 2005 10:59] Vasily Kishkin
Thanks for the bug report. I was able to reproduce the bug. 

ERROR (.\test.c:33): SQLExecDirect()
*** [MySQL][ODBC 3.51 Driver][mysqld-5.0.16]Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
*** ODBC Code: HYT00, Driver Code: 1221

My test case is attached.
[11 Dec 2005 10:59] Vasily Kishkin
Test case

Attachment: test.c (text/plain), 3.52 KiB.

[11 Jul 2007 21:17] Jim Winstead
The syntax as given is wrong, it doesn't work from the CLI, either:

mysql> GRANT RELOAD ON * TO 'admin'@'%' WITH GRANT OPTION;
ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES

The correct syntax is:

GRANT RELOAD ON *.* TO 'admin'@'%' WITH GRANT OPTION;