Bug #110148 MySQL shell util.dumpInstance() comment out GRANTs for schemas with underscore
Submitted: 21 Feb 2023 6:17 Modified: 23 Feb 2023 9:57
Reporter: Ivan V Email Updates:
Status: Verified Impact on me:
None 
Category:Shell Dump & Load Severity:S3 (Non-critical)
Version:8.0.32 OS:Any
Assigned to: CPU Architecture:Any

[21 Feb 2023 6:17] Ivan V
Description:
MySQL shell util.dumpInstance() dumps users to @.users.sql, and if schema name contains underscore, and GRANT contains escaped underscore (not for wildcard), then GRANT is exported as commented out line. The scheme with underscore exists in instance.

File @.users.sql:

-- begin grants 'c21hub'@'localhost'
GRANT USAGE ON *.* TO `c21hub`@`localhost`;
/* GRANT ALL PRIVILEGES ON `advplatform\_buffer`.* TO `c21hub`@`localhost` WITH GRANT OPTION */;
-- end grants 'c21hub'@'localhost'

-- begin grants 'moodle_dev'@'localhost'
GRANT USAGE ON *.* TO `moodle_dev`@`localhost`;
/* GRANT ALL PRIVILEGES ON `moodle\_dev`.* TO `moodle_dev`@`localhost` WITH GRANT OPTION */;
-- end grants 'moodle_dev'@'localhost'

How to repeat:
1. Create schema `moodle_dev`
2. Create user 'moodle_dev' with GRANT on `moodle\_dev`.*
3. Run util.dumpInstance()
4. This GRANT will not be restored on util.loadDump().

Suggested fix:
Maybe it is a bug in code that checks if schema exists on instance.
[23 Feb 2023 9:57] MySQL Verification Team
Hello Ivan V,

Thank you for the report and feedback.

regards,
Umesh