不关机 主从配置mysql_Mysql 配置主从

本文详细介绍了如何在不关闭MySQL服务的情况下,进行主从配置,包括数据库备份、主服务器同步用户创建、从服务器设置、relay log的处理及遇到的问题解决。通过mysqldump进行备份,然后在从服务器上恢复并配置主从关系,确保数据的实时同步。
摘要由CSDN通过智能技术生成

1.备份生产数据库:

mysqldump -uroot -p'1234567' -R --single-transaction --master-data=2 quartz>quartz.sql

mysqldump -uroot -p'1234567' -R --single-transaction --master-data=2 zjzc>zjzc.sql

--master-data 参数:

Use this option to dump a master replication server to produce a dump file that can be used to set up another server as a slave of the master. It causes the dump output to include a CHANGE MASTER

TO statement that indicates the binary log coordinates (file name and position) of the dumped server. These are the master server coordinates from which the slave should start replicating.

If the option value is 2, the CHANGE MASTER TO statement is written as an SQL comment, and thus is informative only; it has no effect when the dump file is reloaded. If the option value is 1, the

statement takes effect when the dump file is reloaded. If the option value is not specified, the default value is 1.

使用这个选项来dump 一个master的复制server 来产生一个dump文件,用于创建另一个slave server. 它使dump调用一个

CHANGE MASTER TO 语句来表明binary log 记录的位置(file name 和position) 这些是master server 记录 slvae开始复制的起点

mysql> show master status;

+------------------+----------+--------------+------------------+-------------------+

| File | Position | Binlog_Do_DB | Binlog_Ignore_DB

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值