It turns out that a user cannot set default database if it does not have global (mysql.user
) or any database-level permissions (mysql.db
):
MariaDB [(none)]> use mysql;
ERROR 1044 (42000): Access denied for user 'XXX'@'%' to database 'mysql'
However, using default database could be convenient, e. i. there is a lot old scripts relying on that.
The only workaround I've found so far, is to grant SHOW VIEW on the database: I do not want to grant even read-only access for all tables.
What do I miss? I don't know any SQL syntax that allows insert 'N' in all relevant columns in mysql.db
, and don't want to do it with raw SQL (INSERT ...
).
root
probably has no entry inmysql.db
, yet has no trouble withUSE
. Please give an example of both theGRANT
andUSE
that cause trouble.