教程集 www.jiaochengji.com
教程集 >  数据库  >  mysql  >  正文 mysqlbinlog把mysql二进制文件转换文本文件

mysqlbinlog把mysql二进制文件转换文本文件

发布时间:2023-04-30   编辑:jiaochengji.com
教程集为您提供mysqlbinlog把mysql二进制文件转换文本文件等资源,欢迎您收藏本站,我们将为您提供最新的mysqlbinlog把mysql二进制文件转换文本文件资源
mysqlbinlog命令是mysql中的一个恢复mysql数据库的工具了,下面本文章再次来为各位介绍利用mysqlbinlog来恢复mysql二进制日志的例子。

目前一些项目已经迁移到Mysql5.5,而在mysql5.5中binlog_format为mixed这样的话,默认情况下的Mysql binary log就是base64格式,不可读,为了在排查问题时候,提供帮助研读下mysqlbinlog的帮助文档得知可以解码:

  –base64-output[=name]
Determine when the output statements should be
base64-encoded BINLOG statements: ’never’ disables it and
works only for binlogs without row-based events;
 ’decode-rows’ decodes row events into commented SQL
                      statements if the –verbose option is also given; ’auto’
prints base64 only when necessary (i.e., for row-based
events and format description events); ’always’ prints
base64 whenever possible. ’always’ is deprecated, will be
removed in a future version, and should not be used in a
production system.  –base64-output with no ’name’
argument is equivalent to –base64-output=always and is
also deprecated.  If no –base64-output[=name] option is
given at all, the default is ’auto’.
mysqlbinlog –base64-output=DECODE-ROWS -v mysql-bin.00002

通过给定–base64-output和-v参数,可以解码row模式下的binary log。

unknown variable ‘default-character-set=utf8mb4′错误

一个手机网的项目,使用的编码为utf8mb4,一切都是正常的。

到了用mysqlbinlog的时候,提示如下:

[root@localhost data]# mysqlbinlog mysql-bin-500.000011
mysqlbinlog: unknown variable ‘default-character-set=utf8mb4′

解决方法:

1. 修改my.cnf,在[client]下注释或删除default-character-set=utf8mb4;
2. 在命令行中加入–no-defaults开关,使用mysqlbinlog –no-defaults;

您可能感兴趣的文章:
mysqlbinlog查看二进制日志时的一个问题
使用mysqlbinlog工具恢复MySQL数据库的方法
利用Mysqlbinlog工具恢复MySQL数据库的例子
MYSQL启用日志,查看日志,利用Mysqlbinlog工具恢复MySQL数据库
自动恢复mysql数据库日志文件的方法
mysql删除binlog日志及使用日志恢复数据的方法
mysql使用 row 格式 binlog 撤销操作
mysql5.6 bin-log日志恢复数据
使用bin-log日志还原数据库的例子
使用binlog恢复mysql数据的简单例子

[关闭]
~ ~