当前位置:Gxlcms > 数据库问题 > mysql 主从不同步问题

mysql 主从不同步问题

时间:2021-07-01 10:21:17 帮助过:27人阅读

的同步服务

  stop slave;

2、主数据库 重置日志

    reset master;

    并查看状态 show master status; 显示如下

  +-------------+----------+--------------+------------------+
| File               | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+-------------     +----------+--------------+------------------+
| data.000001 |     106  | system_db1    |                  |
+-------------+----------+--------------+------------------+

3、从数据库 重置日志

      RESET SLAVE;

4、在从数据库上 设置 读取  主数据库日志的位置

change master to master_host=‘129.90.1.1,master_user=‘root‘,master_password=‘123456‘, master_log_file=‘data.000001‘,master_log_pos=106;

这里参考主数据库的状态值,如第2步的。

start slave; 开启同步服务器

查看从数据库状态中的值是否一致,
show slave status\G

如下

 Slave_IO_State: Waiting for master to send event
                  Master_Host: 129.90.1.1
                  Master_User: root
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: data.000001
          Read_Master_Log_Pos: 106
               Relay_Log_File: mysql-relay-bin.000002
                Relay_Log_Pos: 246
        Relay_Master_Log_File: data.000001
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: system_db
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: 0
                   Last_Error:
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 106
              Relay_Log_Space: 401
              Until_Condition: None
               Until_Log_File:
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File:
           Master_SSL_CA_Path:
              Master_SSL_Cert:
            Master_SSL_Cipher:
               Master_SSL_Key:
        Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 0
               Last_SQL_Error:

查看红色字体部分

剩下的就自己测试下主从是否数据同步了

 

mysql 主从不同步问题

标签:ignore   新建   show   res   路径   ace   nsa   run   定义   

人气教程排行