mysqlbinlog: Character set '#45' is not a compiled character set and is not specified in the '/usr/s


执行mysqlbinlog 命令是遇到的异常。

[shuohai.lhl@v035114 ~]$ mysqlbinlog --host 10.249.193.105 -P3401 -R -u ****** -p****** mysql-bin.000019 -j 4  --base64-output=decode-rows --verbose > 1
mysqlbinlog: Character set '#45' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
mysqlbinlog: Character set '#45' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
mysqlbinlog: Character set '#45' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
mysqlbinlog: Character set '#45' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
mysqlbinlog: Character set '#45' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
mysqlbinlog: Character set '#45' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file

dump binlog时候发现打印出了好多异常,但是依然dump出了结果,生成了文件1。

引用 http://dinglin.iteye.com/blog/1675824  如果是master-slave情况下,slave会卡住。如果是mysqlbinlog工具,只会打印信息说解析失败,还会继续即系其他的内容。

现象:
       从库上Slave_IO_Running停止,Last_Error显示如下:
bin/mysqlbinlog: Character set ‘#45′ is not a compiled character set and is not specified in the ‘/u01/dingqi.lxb/transfer2/master/share/mysql/charsets/Index.xml’ file


分析下异常,说明不是编译的变量,这个好理解。
mysqlbinlog: Character set '#45' is not a compiled character set 

and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
后面的文件,看下发现机器上不存在这个叫做Index.xml的文件,所以怀疑是异常信息不规范,或者应该查的是别的文件,到底是哪个文件呢???

继续,查看本机的mysql版本和mysqlbinlog版本,确实是低版本dump了高版本的mysql。

[shuohai.lhl@v035114 ~]$ mysql -V
mysql  Ver 14.14 Distrib 5.1.57, for unknown-linux-gnu (x86_64) using readline 5.1
[shuohai.lhl@v035114 ~]$ mysqlbinlog -V
mysqlbinlog Ver 3.3 for unknown-linux-gnu at x86_64

接着玩,换一台机器接着dump,换到另一台机器执行

[admin@v125051019 ~]$ mysqlbinlog --host 10.249.193.105 -P3401 -R -u ****** -p****** mysql-bin.000019 -j 4  --base64-output=decode-rows --verbose > 1

这个时候没有出现额外的异常信息了~

为什么呢,查看下mysql版本和mysqlbinlog的版本。

[admin@v125051019 ~]$ mysql -V
mysql  Ver 14.14 Distrib 5.5.17, for Linux (x86_64) using readline 5.1
[admin@v125051019 ~]$ mysqlbinlog -V
mysqlbinlog Ver 3.3 for Linux at x86_64
这台机器的msyql是5.5.17,再看下server的版本是5.5.18

[admin@v125051019 ~]$ mysql --host 10.249.193. -P3401 -u ****** -p******  
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11239893
Server version: 5.5.18.1-tb4373-log Source distribution
没有打印异常日志,好奇看下那个Index.xml长什么模样~~~

原文太长,截个片段吧

<charset name="ascii">
  <family>Western</family>
  <description>US ASCII</description>
  <alias>us</alias>
  <alias>us-ascii</alias>
  <alias>csascii</alias>
  <alias>iso-ir-6</alias>
  <alias>iso646-us</alias>
  <collation name="ascii_general_ci"    id="11" order="English" flag="primary"/>
  <collation name="ascii_bin"           id="65" order="Binary"  flag="binary"/>
</charset>

貌似id就是上文看到的异常提到的东东,查一下45吧,令人失望没找到~~继续困惑了

也许id=45被的character是在编译的时候生成的吧,亦或者是存在于其他文件中,欲知详情,只能源码了~~~

还有在第一台机器上没有找到指定这个Index.xml文件,也只能分析源码才能得到答案了吧


come on and on

查看解析出来的文件,确实发现了语句和45相关

# at 4
#140514 11:05:24 server id 3195034185  end_log_pos 107  Start: binlog v 4, server v 5.5.18.1-tb4373-log created 140514 11:05:24
# at 107
#140514 11:05:24 server id 3195034185  end_log_pos 180  Query   thread_id=9429419       exec_time=0     error_code=0
SET TIMESTAMP=1400036724/*!*/;
SET @@session.pseudo_thread_id=9429419/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=2097152/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
SET @@session.character_set_client=45,@@session.collation_connection=45,@@session.collation_server=33/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
# at 180
# at 319

于是也试验了一把

mysql> set @@session.character_set_client=45;
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like "%character_set_client%" ;
+----------------------+---------+
| Variable_name        | Value   |
+----------------------+---------+
| character_set_client | utf8mb4 |
+----------------------+---------+
1 row in set (0.00 sec)

mysql>

确实是utf8mb4的字符集,但是确实没在Index.xml文件中找到它,是以记之,有机会再追~

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
当执行mysqlbinlog命令时,出现"unknown variable 'default-character-set=utf8'"的错误。这个错误通常发生在将MySQL数据库的编码改为utf8mb4后。这是因为mysqlbinlog命令不支持utf8mb4编码。 解决这个问题的方法是,在执行mysqlbinlog命令时,添加"--no-defaults"参数,以避免读取my.cnf配置文件中的默认选项。具体操作如下: 1. 打开终端或命令行窗口。 2. 输入以下命令并按下回车键:mysqlbinlog --no-defaults [binlog文件路径] > [保存结果的文件路径] 其中,[binlog文件路径]是你要查看的binlog文件的路径,[保存结果的文件路径]是你想要保存结果的文件的路径。 3. 等待命令执行完成,结果会保存在指定的文件中。 通过添加"--no-defaults"参数,mysqlbinlog命令将忽略my.cnf配置文件中的默认选项,从而避免了"unknown variable 'default-character-set=utf8'"的错误。注意,这个方法只适用于mysqlbinlog命令,对其他MySQL命令可能不适用。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [Mysql操作binlog时报错mysqlbinlog: unknown variable 'default-character-set=utf8mb4'](https://blog.csdn.net/u012946310/article/details/82865552)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [mysqlbinlog命令使用时报错 unknown variable 'default-character-set=utf8mb4' 的解决办法](https://blog.csdn.net/aben_sky/article/details/121514406)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [MySQL读取Binlog日志常见的3种错误](https://download.csdn.net/download/weixin_38628310/13700885)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值