我的MYSQL之前做好单向同步的,可是不知道什么原因,现在slave不能和master同步了,我现在想让slave(辅)继续向master(主)同步,但是由于master正在用,现在不能再重启了,请问有什么办法吗?

解决方案 »

  1.   

    贴出你的错误日志以及 show slave status\G结果!
    在SLAVE 机器上:
    stop slave;
    reset slave;
    change master to ...;
    start slave;
      

  2.   

    我试过重启slave了,把DATA里的启动文件删了再启的,可还是不能同步了,是不是因为master正在运行,里面的日志在时时更新的原因?可我现在不能重启master了,有没有办法可以只重启slave而实现同步呢?麻烦高手你帮我想想办法,谢啦
      

  3.   

    1、在master上执行一下sql语句flush tables with read lock;
    show master status;并记下其file和position的值,这两个值会在下面用到2、在slave上执行以下语句stop slave; 
    reset slave; 
    change master to 
    MASTER_HOST='master_ip',
                ->     MASTER_USER='replication_user_name',
                ->     MASTER_PASSWORD='replication_password',
                ->     MASTER_LOG_FILE='recorded_log_file_name',
                ->     MASTER_LOG_POS=recorded_log_position;start slave;替换其中的master_ip,master_user,master_password为master ip地址,具有复制权限的用户,密码
    把recorded_log_file_name替换为上面记录的file,recorded_log_position为上面记录的position3、释放master上的read lockunlock tables;