提问者:小点点

MYsql复制问题。“错误表xxx.xxx不存在。无法开始复制


到目前为止,我花了两天的时间寻找堆栈溢出的答案,谷歌和我只是不能让它工作…

我正在尝试在MySQL/MariaDB中设置主/从复制。但当我开始复制时。只是从机错误说表不存在。

  • 是否需要先创建数据库和表?
  • 如果是,如果在主服务器上创建了一个新表,会发生什么情况?这会中断复制吗?

这是从机的当前状态:

MariaDB [(none)]> show slave status \G;
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: somedomain.com
                  Master_User: someuser
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000002
          Read_Master_Log_Pos: 63687969
               Relay_Log_File: mariadb-relay-bin.000002
                Relay_Log_Pos: 382
        Relay_Master_Log_File: mysql-bin.000001
             Slave_IO_Running: Yes
            Slave_SQL_Running: No
              Replicate_Do_DB:
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: 1146
                   Last_Error: Error 'Table 'xxxxx.xxxx' doesn't exist' on query. Default database: 'xxxxxxxxxxxx'. Query: 'UPDATE xxxx SET lastused = NOW(), lingertime = 7 WHERE siteid = 'xxxxxxxxxxx''
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 98
              Relay_Log_Space: 63763807
              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: NULL
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 1146
               Last_SQL_Error: Error 'Table 'xxxxxxxx.xxxxx' doesn't exist' on query. Default database: 'xxxxxxx'. Query: 'UPDATE xxxxx SET lastused = NOW(), lingertime = 7 WHERE siteid = 'xxxxxxxxxx''
  Replicate_Ignore_Server_Ids:
             Master_Server_Id: 1

共1个答案

匿名用户

我需要先创建数据库和表吗?

是的,你得先做那件事。您必须具有与master上相同的架构和表。

如果是,如果在主服务器上创建了一个新表,会发生什么?这会中断复制吗?

您在主服务器上执行的每个命令也将在从服务器上复制。这包括表和模式的CREATE语句。所以,你不会有任何问题。