[翻译向] 当flush privileges生效时
前言:
最近频繁在mysql权限控制这里栽跟斗,在翻阅了一些资料之后,简单地翻译一下官网关于flush privileges的描述,抛砖引玉。
翻译正文:
If the mysqld server is started without the -skip-grant-tables option, it reads all grant table contents into memory during its startup sequence. The in-memory tables become effective for access control at that point.
如果mysqld服务未使用--skip-grant-tables选项启动,mysql会在启动过程中将权限表的所有内容读取到内存中。此时,内存中的表将对访问控制生效。
If you modify the grant tables indirectly using an account-management statement, the server notices these changes and loads the grant tables into memory again immediately. Examples include GRANT, REVOKE, SET PASSWORD, and RENAME USER.
如果你不直接使用账号管理语句修改权限表,mysql服务会注意到这些改动并立即将其加载到内存当中。账号管理语句包括GRANT, REVOKE, SET PASSWORD, RENAME USER四个。
If you modify the grant tables directly using statements such as INSERT, UPDATE, or DELETE(which is not recommended), the changes have no effect on privilege checking until you either tell the server to reload the tables or restart it. Thus, if you change the grant tables directly but forget to reload them, the changes have no effect until you restart the server. This may leave you wondering why your changes seem to make no difference!
如果你直接使用INSERT, UPDATE, DELETE(DELETE不推荐使用)修改权限表,除非你重新加载这个表,或者重启数据库,这些操作是不会影响权限检查的。因此,如果你修改了权限表但是忘记重新加载它们,直到你重启数据库,这个修改都是无效的。这可能会让你发现,为什么你命名修改了,但是没生效!
To tell the server to reload the grant tables, perform a flush-privileges operation. This can be done by issuing a FLUSH PRIVILEGES statement or by executing a mysqladmin flush-privileges or mysqladmin reload command.
为了告诉服务器重新加载权限表,需要执行一个刷新权限的命令。我们可以在数据库中执行FLUSH PRIVILEGES语句,或者在命令行中执行mysqladmin flush privileges或者mysqladmin reload命令。
A grant table reload affects privileges for each existing client session as follows:
Table and column privilege changes take effect with the client's next request.
Database privilege changes take effect the next time the client executes a
USE *db_name*statement.
**Note**
**Client applications may cache the database name; thus, this effect may not be visible to them without actually changing to a different database.**
- Global privileges and passwords are unaffected for a connected client. These changes take effect only in sessions for subsequent connections.
每次权限表的加载都会对会话有以下影响:
表级和行级的权限会在下次会话连接中改变
数据库级的权限将会在下次USE DB_NAME后改变。
注意:由于客户端存在缓存,如果不是真的切换数据库,此条改变可能不易被察觉。
在同一个连接中,全局权限和密码不发生改变。只有开启新的会话时,才会生效。
If the server is started with the --skip-grant-tables option, it does not read the grant tables or implement any access control. Any user can connect and perform any operation, which is insecure. To cause a server thus started to read the tables and enable access checking, flush the privileges.
如果会话以--skip-grant-tables选项启动,它不会读取权限表,也没有相关访问控制的权限。任何人可以通过--skip-grant-tables进行连接和操作,这是不安全的。如果要从服务器开始读取权限表并保证访问检查,请刷新权限。
总结:
- flush privileges命令的作用是,使得在磁盘空间的修改写入到内存中,使其立即生效。
- 适合使用flush privileges的命令:INSERT、UPDATE、DELETE
- 不适合或不需要使用flush privileges的命令:GRANT、REVOKE、SET PASSWORD、RENAME USER
- 在相关改动之后(尤其是GRANT、REVOKE两箱操作,十分危险),千万不要,不要,不要轻易退出现有连接,否则就有你哭的了!
后记
链接地址,摘自官网:
privileges changeshttps://dev.mysql.com/doc/refman/5.7/en/privilege-changes.html)
[翻译向] 当flush privileges生效时的更多相关文章
- 创建MySQL用户 赋予某指定库表的权限 flush privileges才能生效!!!!;@'localhost'授权本地,@'%'授权远程
update ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value 建议使用GRANT语句进行授权,语句如下: gra ...
- 42 | grant之后要跟着flush privileges吗?
在 MySQL 里面,grant 语句是用来给用户赋权的.不知道你有没有见过一些操作文档里面提到,grant 之后要马上跟着执行一个 flush privileges 命令,才能使赋权语句生效.我最开 ...
- flush privileges是什么意思?
flush privileges 命令本质上的作用是将当前user和privilige表中的用户信息/权限设置从mysql库(MySQL数据库的内置库)中提取到内存里.MySQL用户数据和权限有修改后 ...
- mysql创建新的用户及flush privileges解析
1.首先以root用户登录到mysql mysql -u root -p 2.接着要知道mysql的用户信息是存储在mysql.user(mysql数据库下的user数据表)下的,所以我们只需添加一个 ...
- flush privileges 什么意思
mysql> update mysql.user set password=PASSWORD(‘新密码’) where User=’root’; mysql> flush privile ...
- 42 grant与flush privileges
42 grant与flush privileges 在mysql里, grant是给用户赋权的,一些文档中经常提到在grant执行后,马上执行一个flush privileges,才能使赋权语句生效, ...
- mysql命令flush privileges命令
修改一个用户的密码,命令如下 mysql> update user set password=password('新密码') where user='用户名'; 执行后报错: ERROR 105 ...
- mysql忘记root密码拯救方法(flush privileges)
修改的用户都以root为列.一.拥有原来的myql的root的密码: 方法一:在mysql系统外,使用mysqladmin# mysqladmin -u root -p password " ...
- MySQL flush privileges 명령어
INSERT나 UPDATE, DELETE문을 이용해서 MySQL의 사용자를 추가,삭제하거나, 사용자 권한 등을 변경하였을 때, MySQL에 변경사항을 적용하기 위해서 사용하는 명령 ...
随机推荐
- NetworkX系列教程(6)-对graph进行操作
小书匠Graph图论 graph生成后,除了有查看操作,还有移除等操作,还有其他更多操作,具体可以看这里.下面将比较graph操作前后的不同. 目录: 7.对图进行操作 7.1移除某些节点和边 7.2 ...
- pandas 筛选某一列最大值最小值 sort_values、groupby、max、min
高效方法: dfs[dfs['delta'].isnull()==False].sort_values(by='delta', ascending=True).groupby('Call_Number ...
- 10月清北学堂培训 Day 7
今天是黄致焕老师的讲授~ 历年真题选讲 NOIP 2012 开车旅行 小 A 和小 B 决定外出旅行,他们将想去的城市从 1 到 n 编号,且编号较小的城市在编号较大的城市的西边.记城市 i 的海拔高 ...
- Tomcat单独部署,控制台乱码解决方法
使用Tomcat作为容器,部署项目的时候,发现控制台总是乱码,乱码如下 打开Tomcat的部署目录 找到这一行,将UTF-8改成GBK java.util.logging.ConsoleHandler ...
- 模糊查询(附上源码和jquery-1.12.1.js,jquery-ui.js,jquery-ui.css)
直接上源码: <!doctype html> <html lang="en"> <head> <meta charset="ut ...
- GFS中元数据的管理
GFS 元数据(metadata)中包含三部分: GFS元数据的管理方式: 1.文件的命名空间和块的命名空间: 采用持久化的方式. 对于文件和块的命名空间以及从文件到块的映射:通过向操作日志登记修改而 ...
- mybatis xml中是sql语句报错: Error creating document instance. Cause: org.xml.sax.SAXParseException: The
最近项目折腾了老半天,找了资料才知道是这么回事... 因为语句中有一个小于号“<”,在XML中,会被当成一个页面元素来解析,不会处理为mysql的SQL语句的组成部分,修改如下: 1.在xml的 ...
- 网络攻击-XSS攻击详解
特别提示:本人博客部分有参考网络其他博客,但均是本人亲手编写过并验证通过.如发现博客有错误,请及时提出以免误导其他人,谢谢!欢迎转载,但记得标明文章出处:http://www.cnblogs.com/ ...
- php发现一个神奇的函数
echo strtr('aaddffvvbbcc','avc','242'); //22ddff44bb22 echo '<br>'; echo str_replace('ad',22,' ...
- Flutter移动电商实战 --(40)路由_Fluro的全局注入和使用方法
路由注册到顶层,使每个页面都可以使用,注册到顶层就需要在main.dart中 main.dart注册路由 注入 onGenerateRoute是MaterialApp自带的路由配置项, 首页跳转到详细 ...