zoukankan      html  css  js  c++  java
  • mysql 从设置只读

    read-only
    该选项限制普通用户只有select权限
    
    --read_only         Make all non-temporary tables read-only, with the 
                                   exception for replication (slave) threads and users with 
                                   the SUPER privileg
    
    使所有的非temporary表为只读,除了复制的threads和超级用户
    
    超级用户:
    SUPER privilege :
    
    The SUPER privilege enables an account to use CHANGE MASTER TO , KILL or mysqladmin kill to kill threads belonging to other accounts (you can always kill your own threads), PURGE BINARY LOGS , 
    
    configuration changes using SET GLOBAL to modify global system variables, the mysqladmin debug command, enabling or disabling logging, performing updates even if the read_only system variable is 
    
    enabled, starting and stopping replication on slave servers, specification of any account in the DEFINER attribute of stored programs and views, and enables you to connect (once) even if the 
    
    connection limit controlled by the max_connections system variable is reached.
    
    To create or alter stored routines if binary logging is enabled, you may also need the SUPER privilege, as described in Section 18.6, “Binary Logging of Stored Programs” 
    
    
    超级权限可以让一个账户使用CHANGE MASTER TO ,KILL或者mysqladmin kill 来kill 进程属于另外的账户(你也可以kill 你自己的threads),PURGE BINARY LOGS,
    
    配置改变使用SET GLOBAL 来修改全局系统变量,mysqladmin debug 命令,启用或者关闭logging,执行更新 甚至read_only 系统变量是启用的,启动和关闭复制在slave servers上,
    
    
    指定任何账户在存储程序和视图的定义属性。
    
    
    
    
    
    
    
    测试:
    slave:/etc# mysql -uzjzc_app -p1234567
    
    1.对应用用户无法写入和修改
    mysql> use zjzc;
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    
    Database changed
    mysql> select * from test;
    +------+
    | id   |
    +------+
    |    1 |
    |    2 |
    |    3 |
    +------+
    3 rows in set (0.00 sec)
    
    mysql> insert into test values(4);
    ERROR 1290 (HY000): The MySQL server is running with the --read-only option so it cannot execute this statement
    
    此时zjzc_app用户 不能对表test进行插入
    
    2.对复制用户不影响
    mysql> select * from test;
    +------+
    | id   |
    +------+
    |    1 |
    |    2 |
    |    3 |
    +------+
    3 rows in set (0.00 sec)
    
    mysql>  select * from test;
    +------+
    | id   |
    +------+
    |    1 |
    |    2 |
    |    3 |
    |  100 |
    +------+
    4 rows in set (0.00 sec)
    
    
    
    3.对root用户不影响

  • 相关阅读:
    车载OS盘点及特点分析一:车载OS几大系统介绍
    CTF常用软件/工具
    汽车软件产业研究报告(2020年)
    高级加密标准(AES)分析
    工具 | CTP、SimNow、NSight、快期
    CTF之图片隐写术解题思路
    V2X和车路协同研究:5G V2X将成为数字座舱标配
    腾讯安全正式发布《IoT安全能力图谱》
    Microsoft Remote Desktop Beta 下载地址
    密码学初探|加密模式
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13351605.html
Copyright © 2011-2022 走看看