MySQL权限篇之RELOAD

RELOAD,顾名思义,重载。属系统权限(个人这么认为)。

拥有该权限的用户可以使用FLUSH语句。

比如flush tables、flush logs、flush privileges等待。

D:\temp>mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.7.11-log MySQL Community Server (GPL)




Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.




Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.




Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.




mysql> show grants for 'ut01'@'%';
+-----------------------------------------------------+
| Grants for ut01@%                                   |
+-----------------------------------------------------+
| GRANT USAGE ON *.* TO 'ut01'@'%'                    |
| GRANT REFERENCES ON `test`.`sys_menu` TO 'ut01'@'%' |
| GRANT ALTER ON `test`.`sys_role_menu` TO 'ut01'@'%' |
+-----------------------------------------------------+
3 rows in set (0.00 sec)




mysql> revoke REFERENCES ON `test`.`sys_menu` from 'ut01'@'%';
Query OK, 0 rows affected (0.05 sec)




mysql> revoke ALTER ON `test`.`sys_role_menu` from 'ut01'@'%';
Query OK, 0 rows affected (0.04 sec)




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




mysql> grant reload on *.* to 'ut01'@'%';
Query OK, 0 rows affected (0.09 sec)




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


mysql>

来看看该用户的操作:



D:\temp>mysql -u'ut01'
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 5.7.11-log MySQL Community Server (GPL)


Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql> flush tables;
Query OK, 0 rows affected (0.10 sec)

mysql> flush logs;

Query OK, 0 rows affected (0.35 sec)


mysql> flush hosts;
Query OK, 0 rows affected (0.18 sec)


mysql> flush privileges;
Query OK, 0 rows affected (0.08 sec)


mysql> flush status;
Query OK, 0 rows affected (0.05 sec)


mysql>

不仅限于这些,用户还可以使用mysqladmin执行flush-hosts, flush-logs, flush-privileges, flush-status, flush-tables, flush-threads, refresh以及 reload操作。

其中,reload是告诉数据库重新加载grant tables(权限表:mysql:USER,db,tables_priv,columns_priv,procs_priv,proxies_priv)到内存。是flush-privileges的别名。

refresh是让数据库关闭并重新打开新的binlog文件,并且也将所有表刷出到磁盘(脏数据)。

flush-threads,Flush the thread cache.还不太明白这个动作干了啥。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值