Mysql- from the library read-only setting

When the master-slave setup, if the read-only permission to use the library in my.cnf init_connect from it, from the library using a non-root user (super privileges) login data, you can not do anything, can only maintain master-slave replication.

init_connect='SET collation_connection = utf8_general_ci'
init_connect='SET NAMES utf8'
init_connect='SET autocommit=0'
init_connect='SET global read_only=1

If necessary, a query-based operation of the read-only from the library, in the configuration file required by the implemented configuration read_only = on

My.cnf example from the library

[mysql]
default-character-set=utf8
[mysqld]
autocommit=OFF
skip_name_resolve
skip-external-locking
datadir=/usr/mysql/5.6/data
socket=/var/lib/mysql/mysql.sock
log-bin=mysql-bin
server-id=215
innodb_flush_log_at_trx_commit=1
sync_binlog=1
binlog_format=mixed
lower_case_table_names=1
#主从配置


pid_file=/var/lib/mysql/mysql.pid
#init_connect='SET collation_connection = utf8_general_ci'
#init_connect='SET NAMES utf8'
#init_connect='SET autocommit=0'
#init_connect='SET global read_only=1'
read_only=on
character-set-server=utf8
collation-server=utf8_general_ci
skip-character-set-client-handshake
log_bin_trust_function_creators=1
#user=
port=3306
#innodb
default_storage_engine=InnoDB
innodb_buffer_pool_size=512M
innodb_log_buffer_size=16M
innodb_log_file_size=64M
innodb_file_per_table=1
innodb_autoextend_increment=128M
#innodb_flush_method=0_DIRECT
#other
key_buffer_size=512M
log_error=/usr/mysql/5.6/mysql-error.log
slow_query_log_file=/usr/mysql/5.6/mysql-slow.log
tmp_table_size=200M
max_heap_table_size=200M
table_open_cache = 1024
sort_buffer_size = 1024K
max_allowed_packet = 100M
query_cache_type=0
query_cache_size=0
open_files_limit=65535
[client]
socket=/var/lib/mysql/mysql.sock
port=3306
default-character-set=utf8
View Code

 

Guess you like

Origin www.cnblogs.com/suminem/p/12373345.html