mysql主从同步

1、停止mysql服务:service mysqld stop
2、vim /etc/my.cnf

[mysqld]
server-id=3
replicate-do-db=pres_eims

replicate-do-db=pres_system

replicate-do-db=pres_business

replicate-do-db=pres_sp_business
replicate-ignore-db=pres_options

replicate-ignore-db=test

replicate-ignore-db=pres_iams
replicate-rewrite-db = pres_eims -> riskdb
replicate-rewrite-db = pres_system -> pres_system_slave
replicate-rewrite-db = pres_business -> pres_business_slave
replicate-rewrite-db = pres_sp_business -> pres_sp_business
#replicate-wild-do-table=riskdb.test01
#replicate-wild-do-table=riskdb.test02

port = 33066
basedir = /opt/mysql-8
datadir = /storage/mysql-8/data
#socket = /var/run/mysql/mysql.sock
#socket = /tmp/mysql/mysql.sock

character-set-server = utf8mb4
#collation-server = unf8mb4_unicode_ci
max_connections = 1000
max_allowed_packet = 4000M
default_authentication_plugin = mysql_native_password
secure_file_priv = ''

[client]

port = 33066
#socket = /var/run/mysql/mysql.sock
#socket = /tmp/mysql/mysql.sock

3 、  启动数据库服务:service mysqld start

4、mysql -uroot -p

5、stop slave ;

6、查看master的状态:
show master status;

7、

change master to master_host='ip',
master_port=30306,
master_user='slave',
master_password=' ',
master_log_file='mysql-bin.000048',
master_log_pos=940915971;

8、start slave;  

9、show slave status\G;  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值