Disable access for database

半腔热情 提交于 2021-02-07 14:51:09

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/5792782/disable-access-for-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!