主数据库在windows下,无防火墙。192.168.1.11
从数据库在虚拟机下 ubuntu 配置看上去没啥问题,但是在从db中通过show databases来看,并没有出现主DB中的各个数据库。
没多少分了  贴出主从信息如下:主DB:mysql> show master status\G;
*************************** 1. row ***************************
            File: mysql-bin.000003
        Position: 304
    Binlog_Do_DB:
Binlog_Ignore_DB:
1 row in set (0.01 sec)ERROR:
No query specified
从DB:mysql> show slave status\G;
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 192.168.1.11
                  Master_User: repuser
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000003
          Read_Master_Log_Pos: 304
               Relay_Log_File: ubuntu-relay-bin.000005
                Relay_Log_Pos: 251
        Relay_Master_Log_File: mysql-bin.000002
             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 'test.login_log' doesn't exist' on query. Default database: 'test'. Query: 'update login_log set  serverid=1'
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 106
              Relay_Log_Space: 1447
              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 'test.login_log' doesn't exist' on query. Default database: 'test'. Query: 'update login_log set  serverid=1'
1 row in set (0.00 sec)ERROR: 
No query specified

解决方案 »

  1.   

    1  现在主机上mysqldump --single-transaction --master-data=2 --all-database > /home/my.sql
    2 主机上得my.sql拷贝到丛机上,在slave上  mysql < my.sql
    3 接上主机上得binlog  
    change master to
    其中master_log_file和master_log_pos在my.sql这个备份文件里
    4最后start slave
      

  2.   

    按 @rucypli 说的,你要先进行数据库的备份及恢复工作,才行的,应该是你搭建步骤没做好,推荐一个详细的步骤和描述文档给你 生产环境搭建MySQL复制的教程
      

  3.   

    谢谢
    理解了 log是半吊子 从db根据半吊子log来同步会出错