返回列表 发帖

Error 'Character set '#45' is not a compiled character set and is...的解决

现象:MySQL主从同步出现问题,报错如下:
Last_Error: Error 'Character set '#45' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file' on query. Default database: 'x4j'. Query: 'REPAIR TABLE `mac_art`, `mac_art_relation`, `mac_art_topic`, `mac_art_type`, `mac_comment`, `mac_gbook`, `mac_link`, `mac_manager`, `mac_user`, `mac_user_card`, `mac_user_group`, `mac_user_pay`, `mac_user_visit`, `mac_vod`, `mac_vod_class`, `mac_vod_relation`, `mac_vod_topic`, `mac_vod_type`, `testsync`, `tmptable`'

原因:查看提示位置的Index.xml,这里记录了这个server提供的所有字符集。发现没有id为45的字符集。也就是这个原因,导致slave在同步时,解析出错,导致同步停止。
解决:修改从库的 my.cnf(etc/my.cnf),在[mysqld]下面加入一行:
  1. slave-skip-errors = 22
复制代码
(忽略所有的22错误)
然后重启从库的mysql服务。
欢迎光临:逐梦论坛

MySQL数据库字符集Character set‘#45′导致主从复制停止问题

现象:

从库上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

分析:

此时用MySQL数据库自带的工具mysqlbinlog 执行对应的relaylog文件,也会出现上面这个错误提示。
查看这个提示位置的Index.xml,这里记录了这个server提供的所有字符集。我们发现,其实没有id为45的字符集。
也就是这个原因,导致slave在同步时,解析出错,导致同步停止。

        SET @@session.character_set_client=45,@@session.collation_connection=45,@@session.collation_server=33

        从这个命令中看,是有用户连接进master以后,执行了一个set names xxx (xxx是某个字符集名字),而这个xxx被翻译成45.

复现:

       我们要找出编号45的字符集。在5.5上执行如下命令:

       set‘#45′导致主从复制停止问题" style="margin: 0px; padding: 0px; border-width: 0px; border-style: initial; list-style: none;">

       发现原来是这个叫做utf8mb4的字符集,这个字符集在5.1里面是还没有的。

       解决:

       给我们的提示就是在高版本对低版本的主从中,要注意不要用到低版本不支持的字符集(所以官方并不建议高版本的master同步到低版本的slave)。

        对于已经在Master的里面已经存在的binlog,要让主从能够继续同步,只能在slave_skip_errors里加上 22这个错误号。

      发现原来是这个叫做utf8mb4的字符集,这个字符集在5.1里面是还没有的。

      原文出处:http://www.mysqlops.com/2012/09/11/character-set-45-导致主从停止问题.html

欢迎光临:逐梦论坛

TOP

不错不错,楼主是个绝对高手

TOP

顶你一下,好贴要顶!yahuyulehui.com

TOP

看了,感觉不错,谢谢您提供

TOP

返回列表

Powered by Discuz! 7.2   论坛QQ群:逐梦论坛群

© 2001-2021 Comsenz Inc. 鲁公网安备 37120302000001号