二进制日志MySQL

时间:2012-09-19 13:14:01

标签: mysql backup database-backups binary-log

我有一些来自localhost的二进制日志文件,但是当我写

     mysqlbinlog mysql-bin.000001 > statament.sql

或文本文件只返回乱码,即

    /*!40019 SET @@session.max_insert_delayed_threads=0*/;
    /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
    DELIMITER /*!*/;
    # at 4
    #120919 11:08:54 server id 1  end_log_pos 106   Start: binlog v 4, server v 5.1.33-        community-log created 120919 11:08:54 at startup
    ROLLBACK/*!*/;
    BINLOG '
    potZUA8BAAAAZgAAAGoAAAAAAAQANS4xLjMzLWNvbW11bml0eS1sb2cAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAACmi1lQEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
    '/*!*/;
    # at 106
    #120919 11:26:07 server id 1  end_log_pos 125   Stop
    DELIMITER ;
    # End of log file
    ROLLBACK /* added by mysqlbinlog */;
    /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;

所以这主要是困扰...我没有奴隶设置......任何想法我做错了什么?

谢谢!

2 个答案:

答案 0 :(得分:0)

根据定义,MySQL二进制日志以二进制形式记录数据操作,以节省处理时间和空间。因此,当您检查它们时,您应该向--base64-output=decode-rows客户端添加mysqlbinlog选项,并将输出解码。

答案 1 :(得分:0)

您可以使用:

mysqlbinlog --no-defaults --base64-output=decode-rows -v mysql-bin.000001 > statament.sql

代替--no-defaults --base64-output=decode-row -v