Comment 1 for bug 1724755

Revision history for this message
Fan Zhang (fanzhang) wrote :

I don't think it's a bug.

First, command 'trove user-show-access' corresponds to 'select * from information_schema.SCHEMA_PRIVILEGES', you can find out in the codes https://github.com/openstack/trove/blob/efd2ad9ee922c800e959c09c1061552d9307e61f/trove/guestagent/datastore/mysql_common/service.py#L231.

What user-show-access shows is only relevant to mysql command 'GRANT', it means that if you grant select privilege on db1 and db2 to user foo, you can find something like this:
mysql> select * from information_schema.SCHEMA_PRIVILEGES;
+----------------+---------------+--------------+-------------------------+--------------+
| GRANTEE | TABLE_CATALOG | TABLE_SCHEMA | PRIVILEGE_TYPE | IS_GRANTABLE |
+----------------+---------------+--------------+-------------------------+--------------+
| 'foo'@'%' | NULL | db1 | SELECT | NO |
| 'foo'@'%' | NULL | db2 | SELECT | NO |
+----------------+---------------+--------------+-------------------------+--------------+

What if you grant select privilege on a database that's not exist to user foo?

The answer is that you can see something new from information_schema.SCHEMA_PRIVILEGES like this:
mysql> select * from information_schema.SCHEMA_PRIVILEGES;
+----------------+---------------+--------------+-------------------------+--------------+
| GRANTEE | TABLE_CATALOG | TABLE_SCHEMA | PRIVILEGE_TYPE | IS_GRANTABLE |
+----------------+---------------+--------------+-------------------------+--------------+
| 'foo'@'%' | NULL | db1 | SELECT | NO |
| 'foo'@'%' | NULL | db2 | SELECT | NO |
| 'foo'@'%' | NULL | db3 | SELECT | NO |
+----------------+---------------+--------------+-------------------------+--------------+

You can find out more here https://dev.mysql.com/doc/refman/5.7/en/schema-privileges-table.html.