Bug #41717 User Has Rights To Database That Does Not Exist advisor alerts incorrectly
Submitted: 23 Dec 2008 17:14 Modified: 18 Sep 2009 16:22
Reporter: Kyle Joiner Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Enterprise Monitor: Advisors/Rules Severity:S3 (Non-critical)
Version:2.0.1.7125, 2.0.x OS:Any
Assigned to: Andy Bang CPU Architecture:Any
Tags: advisor, Database name, grant

[23 Dec 2008 17:14] Kyle Joiner
Description:
Create a database with an '_' score in the name then Grant a user privileges to this database with the '\_' to prevent wildcards is incorrectly identified by Enterprise dashboard advisor 'User Has Rights To Database That Does Not Exist' as not having a database for the privilege.

How to repeat:
on the Monitored MySQL server:
CREATE DATABASE test_foo;
GRANT SELECT ON `test\_foo`.* to testuser@'localhost' identified by 'test';

Advisor warns these users have rights to a database that does not exist:
    * ''@'%' on DB test_%,
    * 'test'@'localhost' on DB test_foo,
    * 'testuser'@'localhost' on DB test_foo

Suggested fix:
correct the sql syntax problem.
[22 Jun 2009 12:52] Mark Leith
Fix pushed:

1383 Mark Leith	2009-06-22 [merge]
     Fix for Bug #41717 - we want to ignore backslashes when joining.
[6 Jul 2009 17:53] Enterprise Tools JIRA Robot
Diego Medina writes: 
Verified fixed on 2.1.0.1071
[20 Jul 2009 14:15] Tony Bedford
An entry has been added to the 2.1.0 changelog:

The advisor “User Has Rights To Database That Does Not Exist” generated erroneous alerts.

If a database was created with an “_” character in the name, and then user privileges granted to this database using the escaped character sequence “\_” to prevent wildcards, then the advisor generates an error stating there is no database for the privilege.

For example, if the following is carried out on the monitored server:

CREATE DATABASE test_foo;
GRANT SELECT ON `test\_foo`.* to testuser@'localhost' identified by 'test';

then the advisor warns that these users have rights to a database that does not exist:

''@'%' on DB test_%,
'test'@'localhost' on DB test_foo,
'testuser'@'localhost' on DB test_foo
[18 Aug 2009 20:26] Mark Leith
Pushed this to the 2.0 branch as well:

revno: 1253
committer: Mark Leith <mark.leith@sun.com>
branch nick: 2.0
timestamp: Tue 2009-08-18 21:17:42 +0100
message:
  Fix for Bug #41717 - we want to ignore backslashes when joining. (Backporting from 2.1)
[26 Aug 2009 17:57] Enterprise Tools JIRA Robot
Diego Medina writes: 
Verified fixed on 2.0.6.7159
[18 Sep 2009 16:22] Tony Bedford
Also added to 2.0.6 changelog.