0

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; 
2
  • In some versions, a wildcard user is granted privileges to schemas matching '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%' Commented Jun 20, 2022 at 14:18
  • thanks @BillKarwin to point me in the right direction, I will add a comment explaining the issue Commented Jun 21, 2022 at 15:45

1 Answer 1

1

Thanks to @BillKarwin to point me in the right direction.

enter image description here

This can be done running https://mariadb.com/kb/en/mysql_secure_installation/

1
  • Recent versions of MySQL have decided not to create a 'test' schema or the privileges to all users for that schema by default, for the reason of security. Commented Jun 21, 2022 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.