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 (OCA) 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.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.