liunx下搭建mysql主从_linux下搭建mysql主从
在master上創建repl賬戶,用于復制。
grant replication slave on *.* to [email?protected]%‘ identified by ‘P@$$W0rd‘;
flush privileges;
與windows下搭建mysql主從的區別:
二進制日志的路徑格式不一樣
master:
my.cnf部分配置(master):
thread_handling = pool-of-threads
thread_pool_oversubscribe = 10
skip-name-resolve
# Replication Master Server (default)
# binary logging is required for replication
#log-bin=mysql-bin
# binary logging format - mixed recommended
binlog_format=mixed
# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id???? = 1
expire_logs_days??????? = 10
max_binlog_size???????? = 100M
log_bin???????????????? = /var/lib/mysql/mysql-bin.log?? #確保此文件可寫
read-only????????????? =0? #主機,讀寫都可以
binlog-do-db???????? =yourdb?? #需要備份數據,多個寫多行
binlog-ignore-db??? =mysql #不需要備份的數據庫,多個寫多行
slave:
master:
show variables like ‘%log_bin%‘;
show master status
slave:
stop slave;
change master to
master_host=‘192.168.103.56‘,
master_user=‘repl‘,
master_password=‘P@$$W0rd‘,
master_log_file=‘mysql-bin.000002‘,
master_log_pos=120;
start slave;
show slave status;
原文:http://www.cnblogs.com/suixinpeng/p/5341193.html
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的liunx下搭建mysql主从_linux下搭建mysql主从的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 《Go语言实战》读书笔记——关于Go语言
- 下一篇: Go语言实战-golang操作MySQL