zoukankan      html  css  js  c++  java
  • mysql 主从搭建步骤

    mysql 主从搭建步骤
    1:主库开启master端bin-log
    2:主库创建备份用户
    3:主库全备
    4:从库导入全备数据
    5:从库修改change master to信息
    6:从库slave start
     
     
    0 确认server_id和binlog
    vim my.cnf
    log-bin=/data/3306/mysql-bin #master开启binlog
    server_id=1 #主从必须不同

    1 master上创建用户
    grant replication slave on *.* to 'rep'@'192.168.1.%' identified by '123456';
    flush privileges;

    2 锁表全备
    flush tables with read lock;
    show master status;

    mysqldump -uroot -pxxxx -A -B --events --single-transaction --master-data=1|gzip > full.sql.gz

    unlock table;

    3 从库导入备份
    gzip -d full.sql.gz
    mysql -uroot -pxxxx < full.sql

    4 配置同步
    change master to
    master_host='xxxx',
    master_port=3306,
    master_user='rep',
    master_password='xxxxxxx'


    5 从库启用同步
    start salve
    show slave statusG;





  • 相关阅读:
    HDU 1423
    POJ 3264
    POJ 3177
    CodeForces 81A
    SPOJ RATING
    ZOJ 2588
    POJ 1523
    POJ 3667
    递归
    数据结构
  • 原文地址:https://www.cnblogs.com/yangliheng/p/5703346.html
Copyright © 2011-2022 走看看