当前位置:   article > 正文

MySQL权限篇之RELOAD_mysql reload

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.还不太明白这个动作干了啥。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/秋刀鱼在做梦/article/detail/882844
推荐阅读
相关标签
  

闽ICP备14008679号