如何阻止 mySQL 用户调用“show”功能

发布于 2024-08-13 01:20:06 字数 107 浏览 2 评论 0原文

我们怎样才能阻止查询“显示数据库;”或“显示表格;”在 mysql 中对于任何非 root 用户。这可能吗。如果可以,请提供示例或适当的链接...表明这一点。

提前致谢........

How can we prevent the the query "show databases;" or "show tables;" in mysql for any non root user.Is this possible.If so please provide an example or appropriate link...indicating this..

Thanks in advance........

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

数理化全能战士 2024-08-20 01:20:06

非 root 用户仅在拥有全局权限时才能看到所有数据库(例如 GRANT something ON *.*)。因此,解决方案是始终授予 ON databasename.* 上的所有内容,而不是全局的。

Non-root user sees all databases only if he has global rights (like GRANT something ON *.*). So the solution is to always grant everything ON databasename.* , never global.

猫腻 2024-08-20 01:20:06

我会尝试一下 show_db_priv

http://dev.mysql.com/doc/refman/5.1/en/grant-table-struction.html

但是,有报道称这不起作用。请参阅此错误条目:

http://bugs.mysql.com/bug.php?id =1048

I would give show_db_priv a try:

http://dev.mysql.com/doc/refman/5.1/en/grant-table-structure.html

But, there have been reports of this not working. See this bug entry:

http://bugs.mysql.com/bug.php?id=1048

两相知 2024-08-20 01:20:06

现在无法为您提供链接,但这本质上是权限问题以及对根用户访问的控制。

在 phpmyadmin 或其他一些工具上,您想要撤销除 root 管理员之外的所有用户对这两个数据库(以及任何其他数据库)的权限。如果您在一台共享服务器上,通常只有一个用户使用一个数据库,那么您需要与您的主机进行通信。

我的一般规则(如果我对数据库服务器有权限控制)是为特定数据库或(表的子集)创建一个新用户,并且始终仅从网络或与数据库通信的其他应用程序中使用该用户。一开始需要更多的设置,但是一旦设置完毕,您就拥有了更多的控制权,并且知道一个应用程序不会干扰另一个应用程序。

根访问权限根本不允许用于应用程序使用 - 其仅用于维护。

Can't get you a link right now, but this is a permissions issue at heart and control over access to the root user.

On something like phpmyadmin or some other tool, you want to revoke permissions on these two databases (and any others) to all users except for your root admin. If you're on a shared server where you typically get one user for your one database you'll need to talk to your host.

My general rule (if I've got permissions control over the db server) is to create a new user for a specific database or (subset of tables) and always use that user only from the web or other application that talks to the db. It's more setup initially, but once you've got it setup you've got much more control and know that one application can't interfere with another.

Root access is simply not allowed for application use - its for maintenance only.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文