禁用对数据库的访问 [英] Disable access for database
本文介绍了禁用对数据库的访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个 MySQL 服务器.现在用户 login
可以访问所有数据库.我希望这个用户不能访问(所以不能做任何事情)到 3 个数据库:
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
因此用户可以使用除这 3 个数据库之外的所有数据库.我该如何完成此操作?
So the user can use all databases except these 3. How can I get this done?
推荐答案
如何做到这一点的简要版本(主要在 我在上面发布的链接):
A brief version of how to do this (which is mostly explained in the link I posted above):
- 您需要
REVOKE
该用户的GLOBAL
权限 - 这是因为 MySQL 的权限系统是自上而下的.如果他们对SELECT
拥有GLOBAL
权限,那么这适用于所有你的数据库 - 然后您需要
GRANT
对确实需要访问的权限的正确权限(您可以为此使用通配符)
- You need to
REVOKE
that user'sGLOBAL
privileges - this is because MySQL's privilege system is top-down. If they have aGLOBAL
privilege toSELECT
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)
需要注意的是,MySQL 没有任何拒绝"权限的概念.
这篇关于禁用对数据库的访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文