暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Gbase中rename表所需要的最小权限

原创 yqq 2020-08-21
1233

Gbase中如果要rename一张表,所需要的最小权限

以y4用户执行rename表的操作
gbase> alter table t8 rename to t88;
ERROR 1142 (42000): DROP,ALTER command denied to user ‘y4’@‘127.0.0.1’ for table ‘t8
gbase>
gbase> alter table t8 rename to t88;
ERROR 1142 (42000): INSERT,CREATE command denied to user ‘y4’@‘127.0.0.1’ for table ‘t88
gbase>
gbase> alter table t8 rename to t88;
Query OK, 0 rows affected (Elapsed: 00:00:00.23)

gbase> show grants for y4;
±--------------------------------------------------------------------------------------------------+
| Grants for y4@% |
±--------------------------------------------------------------------------------------------------+
| GRANT USAGE ON . TO ‘y4’@’%’ IDENTIFIED BY PASSWORD ‘E7E7’ |
| GRANT SELECT ON “testdb”.
TO ‘y4’@’%’ |
| GRANT INSERT, CREATE ON “testdb”.“t88” TO ‘y4’@’%’ |
| GRANT DROP, ALTER ON “testdb”.“t8” TO ‘y4’@’%’ |
±--------------------------------------------------------------------------------------------------+
4 rows in set (Elapsed: 00:00:00.00)

gbase中对大表进行rename的操作,一闪而过,rename命令会直接修改底层的.frm文件,以及变更了数据字典中的table name,不会真的重新建表迁移数据。

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论