mysql怎么实现热备份 mysql热备份步骤

主机教程 建站分享 2年前 (2022-12-15) 178次浏览

文章摘要:mysql怎么实现热备份 mysql热备份步骤

mysql热备份主要分为主从备份和主主备份两种,下面介绍mysql实现主从备份的方法 1.主服务器配置 [my […]

mysql热备份主要分为主从备份和主主备份两种,下面介绍mysql实现主从备份的方法

1.主服务器配置

[mysqld]

#主从备份

log-bin=mysql-bin

binlog_format=mixed

server-id=1

read-only=0

binlog-do-db=mydb

binlog-ignore-db=mysql

binlog-ignore-db=test

binlog-ignore-db=information_schema

binlog-ignore-db=performance_schema

#双主备份

#auto-increment-increment=10

#auto-increment-offset=1

2.从服务器配置

[mysqld]

#主从备份

#log-bin=mysql-bin

#binlog_format=mixed

server-id=2

replicate-do-db=mydb

replicate-ignore-db=mysql

replicate-ignore-db=test

replicate-ignore-db=information_schema

replicate-ignore-db=performance_schema

replicate-wild-ignore-table=mydb.000%

replicate-wild-ignore-table=mydb.tmp%

replicate-wild-ignore-table=mysql.%

replicate-wild-ignore-table=test.%

replicate-wild-ignore-table=information_schema.%

replicate-wild-ignore-table=performance_schema.%

relay_log=mysql-relay-bin

log-slave-updates=ON

3.在mysql中创建一个备份用户

grant replication slave on *.* to 'backup'@'192.168.0.42' identified by '123456';

4.在从服务器中开启主从备份

mysql> CHANGE MASTER TO

    MASTER_HOST='192.168.0.41',

    MASTER_USER='backup',

    MASTER_PASSWORD='123456',

    MASTER_LOG_FILE='mysql-bin.000001',

    MASTER_LOG_POS=106;

5.主从备份开启后,重启mysql服务即可

sudo service mysql restart


声明:
若非注明,本站文章源于互联网收集整理和网友分享发布,如有侵权,请联系站长处理。
文章名称:mysql怎么实现热备份 mysql热备份步骤
文章链接:http://www.7966.org/post/14655.html
转载请注明出处

喜欢 (0)