Bug #61431 Grant suggestion for slave user on mysql.inventory uses wrong hostname
Submitted: 7 Jun 2011 9:07 Modified: 9 Jan 2015 10:21
Reporter: Daniël van Eeden Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Enterprise Monitor: Agent Severity:S4 (Feature request)
Version:2.3.4.2075 OS:Any
Assigned to: CPU Architecture:Any

[7 Jun 2011 9:07] Daniël van Eeden
Description:
If the user for the slave doesn't have select permissions on mysql.inventory then a warning will be put in the debug log:

2011-06-07 10:52:47: (message) mysql-query (127.0.0.1:3306): SHOW SLAVE STATUS
2011-06-07 10:52:47: (message) job_collect_mysql.c:702: [127.0.0.1:3306->10.94.62.50:3306] (master-uuid) mysql-query(SELECT value FROM mysql.inventory WHERE name='uuid')
2011-06-07 10:52:47: (warning) job_collect_mysql.c:714: [127.0.0.1:3306->10.94.62.50:3306] (master-uuid) mysql_real_query(SELECT value FROM mysql.inventory WHERE name='uuid') on the slave's master failed: SELECT command denied to user 'rep-db01'@'db01-adm.example.com' for table 'inventory' (1142)
Check that mysql.inventory exists on this slave's master, if it does, run on the master:
GRANT SELECT ON mysql.inventory TO 'rep-db01'@'%';

The GRANT statement is wrong. It should've used CURRENT_USER() instead of %.

How to repeat:
See Description.

Suggested fix:
use CURRENT_USER() instead of %.
[7 Jun 2011 9:51] Arnaud Adant
Thanks for this feature request.

We suppose you need that feature for security reasons.
[7 Jun 2011 10:11] Daniël van Eeden
There is no such user as 'rep-db01'@'%', that's why the grant statement is not correct. 

If sql_mode is not set to NO_AUTO_CREATE_USER this would create a new user without password.

The CURRENT_USER() function should be used to find the correct hostname and user.