Wishlist 0 ¥0.00

mysql新创建的用户就拥有information_schema表的权限,有问题吗?需要删除这个权限吗?

mysql 8.0 新建用户:

create user 'us_user'@'%' identified by '123456';

创建完之后查看该用户的权限:

mysql> show grants for 'us_user';
+-------------------------------------+
| Grants for us_user@%                |
+-------------------------------------+
| GRANT USAGE ON *.* TO `us_user`@`%` |
+-------------------------------------+
1 row in set (0.00 sec)

使用该帐号登录,然后:

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
+--------------------+
1 row in set (0.02 sec)

请问:

(1) GRANT USAGE ON . TO us_user@% 是什么意思?我该如何取消这个权限呢?

(2)这个帐号为啥一创建就能够访问 information_schema 这个表?有危险吗?我这个帐号是准备对外公开的,我希望他仅能对我之后新建的某个数据库有所有权限,而不会对我的整个数据库造成安全漏洞。

谢谢大佬回答。

 回答:
 

1.不用。因为它不会给用户操作权限。
2.'information_schema'只提供关于数据库结构的信息,而且不能用于修改数据,所以没有安全问题。
如果你想要限制可以先创建 my_new_database:

CREATE DATABASE my_new_database;

然后分配权限:

GRANT ALL PRIVILEGES ON my_new_database.* TO 'us_user'@'%';

About Us

Since 1996, our company has been focusing on domain name registration, web hosting, server hosting, website construction, e-commerce and other Internet services, and constantly practicing the concept of "providing enterprise-level solutions and providing personalized service support". As a Dell Authorized Solution Provider, we also provide hardware product solutions associated with the company's services.
 

Contact Us

Address: No. 2, Jingwu Road, Zhengzhou City, Henan Province

Phone: 0086-371-63520088 

QQ:76257322

Website: 800188.com

E-mail: This email address is being protected from spambots. You need JavaScript enabled to view it.