I've created a user in our mysql/mariaDB engine so our customers can read some views. User has been created as follows and can query the views with no problem.
CREATE USER IF NOT EXISTS "user_viewer"@"%" IDENTIFIED BY "password";
...
GRANT SELECT ON mydb.my_view1 TO 'user_viewer'@'%';
GRANT SELECT ON mydb.my_view2 TO 'user_viewer'@'%';
However, I'm wondering that this user has full read access to "information_schema" and "test" schemas. I understand that first is a dynamically built table necessary for normal usage but I don't understand why it has access to "test" (created automatically by mariaDB during deployment), even when I revoke all privileges with
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'iristrace_viewer'@'%';
FLUSH PRIVILEGES;
'test%'
so any user implicitly has access to any schema name starting with test. I don't have MariaDB, but I think you can try checking:SELECT * FROM mysql.db WHERE db LIKE 'test%'