Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable access for database

I created a MySQL server. Now the user login has access to all databases. I want this user not to have access (so can't do anything) to 3 databases:

  • information_schema
  • mysql
  • phpmyadmin

So the user can use all databases except these 3. How can I get this done?

like image 429
www.data-blogger.com Avatar asked Oct 11 '22 05:10

www.data-blogger.com


1 Answers

A brief version of how to do this (which is mostly explained in the link I posted above):

  • You need to REVOKE that user's GLOBAL privileges - this is because MySQL's privilege system is top-down. If they have a GLOBAL privilege to SELECT then that applies to all of your databases
  • You then need to GRANT the correct privileges on the ones it does need access to (you can use wildcards for this)

It's important to note that MySQL does not have any concept of a "DENY" privilege.

like image 62
Simon Avatar answered Oct 13 '22 17:10

Simon