Bug #79106 SHOW GRANTS uses single quotes and backticks inconsistently
Submitted: 4 Nov 2015 0:02 Modified: 4 Nov 2015 0:31
Reporter: Felipe Gasper (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.6 OS:Any
Assigned to: CPU Architecture:Any

[4 Nov 2015 0:02] Felipe Gasper
Description:
MySQL 5.6 has introduced an inconsistency in whether SHOW GRANTS quotes user/host pairs using single quotes or backticks.

This is the (parsed) output from a test I have that creates a temporary 5.6.27-log server and does a SHOW GRANTS command:

          'GRANT SELECT, INSERT ON `a_base`.* TO `user`@`host` IDENTIFIED BY PASSWORD \'*password\' WITH GRANT OPTION',
          'GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD ON `mybase`.* TO `user`@`host` IDENTIFIED BY PASSWORD \'*password\' WITH GRANT OPTION',
          'GRANT SELECT ON *.* TO `user`@`host` IDENTIFIED BY PASSWORD \'*password\' WITH GRANT OPTION',
          'GRANT EXECUTE ON PROCEDURE `test`.`myproc` TO \'user\'@\'host\''

Notice the inconsistency.

I’m marking this one Serious because we have parsing code that is breaking on the inconsistency.

How to repeat:
It’s inconsistent, but it seems to depend on whether there are different kinds of user/host/password setups?

Suggested fix:
It should always use single quotes. That’s what’s been documented for years, and that’s what applications expect.
[4 Nov 2015 0:31] Felipe Gasper
Never mind … was a quirk of a particular test that produced that grant syntax, not MySQL.

Sorry for the spam.