禁用对数据库的访问 [英] Disable access for database

查看:56
本文介绍了禁用对数据库的访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个 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):

  • 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)

需要注意的是,MySQL 没有任何拒绝"权限的概念.

这篇关于禁用对数据库的访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆