Skip to content

Instantly share code, notes, and snippets.

@Linuxpizi
Created March 31, 2020 06:43
Show Gist options
  • Save Linuxpizi/b525a8d85329791fcd89ba467b87158a to your computer and use it in GitHub Desktop.
Save Linuxpizi/b525a8d85329791fcd89ba467b87158a to your computer and use it in GitHub Desktop.
关于MySQL读写权限

MySQL读写权限的解读

read_only

read_only

  1. 参数限制的只是普通的用户只读,对于super用户没有限制的能力
  2. 它也不会限制主从的同步
# 查询
show variables like 'read_only'

# 设置
set global read_only = ON

flush tables with read lock;

  1. flush tables with read lock是会话级别的只读,如果别的会话进行操作Insert,Delete,Update 还是会生效的。
  2. super用户也是只有只读权限
  3. 会阻止主从同步
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment