• mysql5.5 Replication 主从同步


    mysql5.5 Replication 主从同步


    ------------------[主]------------------
    [mysqld]
    server-id=1
    log-bin=mysql-bin
    binlog-do-db=testdb

    mysql>create user repl_user@192.168.144;
    mysql>grant replication slave on *.* to repl_user@192.168.1.144 identified by '123456';

    mysql>flush tables with read lock;
    mysqldump testdb -uroot  -pklasdjfa --opt | mysql testdb -uroot -pklasdjfa -h 192.168.1.144
    mysql>unlock tables;


    重启



    ------------------[存]------------------
    [mysqld]
    server-id=2
    log-bin=mysql-bin
    replicate-do-db=testdb

    重启

    mysql> show master status;
    +------------------+----------+--------------+------------------+
    | File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
    +------------------+----------+--------------+------------------+
    | mysql-bin.000001 |      107 |              |                  |
    +------------------+----------+--------------+------------------+

    mysql> slave stop;

    mysql> change master to master_host='192.168.1.145',
        master_user='repl_user',
        master_password='123456',
        master_log_file='mysql-bin.000001',
        master_log_pos=107;

    mysql> slave start;

    mysql> show slave statusG

  • 相关阅读:
    我深知黑暗,但心向光明(记毕业后第一次在北京求职)
    CF 1200E HASH模板
    CF580D
    CF1433F
    CF1451 E1交互题
    11.23-11.29 训练计划
    11.22 CF总结 #682
    sql问题:备份集中的数据库备份与现有的 '办公系统' 数据库不同
    内容导出成word
    让超链接无法跳转的方法
  • 原文地址:https://www.cnblogs.com/vc60er/p/3181822.html
Copyright © 2020-2023  润新知