Bug #98738 You must escape database name with a backslash if it includes an underscore.
Submitted: 25 Feb 2020 15:05 Modified: 25 Feb 2020 15:19
Reporter: Chris Gillepie Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:8.0.19 OS:Any
Assigned to: CPU Architecture:Any

[25 Feb 2020 15:05] Chris Gillepie
Description:
According to the online documentation https://dev.mysql.com/doc/refman/8.0/en/request-access.html You must include an underscore when using a wildcard character % and _.

This is done automatically in the Gui workbench but not in the command line tool. If you add \ you receive an error.

How to repeat:
mysql> GRANT EXECUTE ON vagt\_db.* TO 'r_basic';
ERROR:
Unknown command '\_'.
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 '\_db.* TO 'r_basic'' at line 1
mysql>

Here is works without using the \ character.

mysql> GRANT EXECUTE ON vagt_db.* TO 'r_basic';
Query OK, 0 rows affected (0.04 sec)

mysql>
[25 Feb 2020 15:19] MySQL Verification Team
Hi Mr. Gillepie,

Thank you for your bug report.

However, our Workbench and our mysql CLI do not work in the same function.

With our command line interface, you have to use a command like this:

GRANT EXECUTE ON `vagt\_db`.* TO 'r_basic';

Not a bug.