Character set 'utf8mb4' is not a compiled character set
近期在一次MySQL数据迁移的过程中遭遇了字符集的问题,提示为"Character set 'utf8mb4' is not a compiled character set"。即是字符集utf8mb4不是一个编译的字符集以及没有在Index.xml文件中指定。以下是其处理过程及解决的方法。供大家參考。
1、错误提示
SHELL> mysqlbinlog --database=bs_salary --stop-datetime="2014-12-15 8:24:48" /home/robin/mysql-bin.000399 \
> |mysql -uroot -p --force --database=salary_1215
mysql: Character set 'utf8mb4' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
2、分析与解决
a、错误分析
从给出的错误提示来看,说utf8mb4字符集未被编译。而其实这个字符集根本没实用到。
其次说这个文件中/usr/share/mysql/charsets/Index.xml未指定utf8mb4字符集,须要检查字符集文件夹设置。
b、字符集检查
首先检查了新旧环境的字符集设置。两边都为UTF8,例如以下
mysql> show variables like '%char%';
+--------------------------+---------------------------------+
| Variable_name | Value |
+--------------------------+---------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /app/soft/mysql/share/charsets/ |
+--------------------------+---------------------------------+
# Author : Leshami
# Blog : http://blog.csdn.net/leshami
c、服务器字符集路径设置
对于字符集的路径设置,与错误提示不一致。尝试改动器配置文件
SHELL> tail -3 /etc/my.cnf
[client]
#default-character-set=utf8
character-sets-dir=/app/soft/mysql/share/charsets/
改动配置文件后再次碰到错误提演示样例如以下,因此字符集路径不是主要原因
mysql: Character set 'utf8mb4' is not a compiled character set and is not specified in the '/app/soft/mysql/share/charsets/Index.xml' file
SHELL> /app/soft/mysql/share/charsets/Index.xml /app/soft/mysql/share/charsets/Index.xml.bk
d、加入utf8mb4字符集到Index.xml
直接复制utf8的配置。改为utf8mb4后。加入到/app/soft/mysql/share/charsets/Index.xml故障解决。
<charset name="utf8mb4">
<family>Unicode</family>
<description>UTF-8 Unicode</description>
<alias>utf-8</alias>
<collation name="utf8_general_ci" id="33">
<flag>primary</flag>
<flag>compiled</flag>
</collation>
<collation name="utf8_bin" id="83">
<flag>binary</flag>
<flag>compiled</flag>
</collation>
</charset>
3、MySQL官方解释
https://dev.mysql.com/doc/refman/5.5/en/charset-configuration.html
If you try to use a character set that is not compiled into your binary, you might run into the following problems:
Your program uses an incorrect path to determine where the character sets are stored (which is typically the
share/mysql/charsets
orshare/charsets
directory under the MySQL installation directory). This can be fixed by using the--character-sets-dir
option when you run the program in question. For example, to specify a directory to be used by MySQL client programs, list it in the[client]
group of your option file. The examples given here show what the setting might look like for Unix or Windows, respectively:[client]
character-sets-dir=/usr/local/mysql/share/mysql/charsets [client]
character-sets-dir="C:/Program Files/MySQL/MySQL Server 5.5/share/charsets"The character set is a complex character set that cannot be loaded dynamically. In this case, you must recompile the program with support for the character set.
For Unicode character sets, you can define collations without recompiling by using LDML notation. See Section 10.4.4, “Adding a UCA Collation to a Unicode Character Set”.
The character set is a dynamic character set, but you do not have a configuration file for it. In this case, you should install the configuration file for the character set from a new MySQL distribution.
If your character set index file does not contain the name for the character set, your program displays an error message. The file is named
Index.xml
and the message is:Character set '
charset_name
' is not a compiled character set and is not
specified in the '/usr/share/mysql/charsets/Index.xml' fileTo solve this problem, you should either get a new index file or manually add the name of any missing character sets to the current file.
You can force client programs to use specific character set as follows:
[client]
default-character-set=charset_name
This is normally unnecessary. However, when character_set_system
differs from character_set_server
or character_set_client
, and you input characters manually (as database object identifiers, column values, or both), these may be displayed incorrectly in output from the client or the output itself may be formatted incorrectly. In such cases, starting the mysql client with --default-character-set=
—that is, setting the client character set to match the system character set—should fix the problem.system_character_set
从上面的描写叙述来看我这个情形。提示的路径与character-sets-dir路劲不一致。通过改动配置文件后,保持了一致。
找到缺省的Index.xml配置文件是因为多版本号的问题。二是不清楚为什么要加入utf8mb4这个配置到index.xml文件,根本没用到这个字符集。我预计是要所有检測一遍。尽管加入可用了,可是还是感觉不那么可靠。
Character set 'utf8mb4' is not a compiled character set的更多相关文章
- MySQL报错: Character set ‘utf8mb4‘ is not a compiled character set and is not specified in the ‘/usr/share/mysql/charsets/Index.xml‘ file
由于日常程序使用了字符集utf8mb4,为了避免每次更新时,set names utf8mb4,就把配置文件改了,如下: [root@~]# vim /etc/my.cnf #my.cnf [clie ...
- mysql: Character set 'utf8mb4' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
mysql: Character set 'utf8mb4' is not a compiled character set and is not specified in the '/usr/sha ...
- Unknown initial character set index '255' received from server. Initial client character 解决方法
Unknown initial character set index '255' received from server. Initial client character set can be ...
- Non-ASCII character '\xe8' in file xxx.py on line 8, but no encoding declared
使用网上某个python程序.编译时报错: File "xxx.py", line 8 SyntaxError: Non-ASCII character '\xe8 ...
- 使用gridlayout布局后,因某些原因又删除,并整理文件夹结构时,Unable to resolve target 'android-7'
出现的问题 [2013-01-11 10:52:39 - gridlayout_v7] Unable to resolve target 'android-7' 事由:在一次做九宫格时.误使用了gri ...
- 追索权 Eclipse + NDK error: stray '\24' in program
[size=16px][b][color=#FF0000]追索权 Eclipse + NDK error: stray '\24' in program[/color][b][/b][/b][/si ...
- 错误号码2003 Can't connect to MySQL server 'localhost' (0)
错误描写叙述 错误原因 近期,我一直都能够用SQLyog连接本地数据库,可是近几天却无法连接:而且一直都报上述错误,我查阅了非常多资料,发现有非常多中说法 总结一下 第一,MySQL中的my.ini出 ...
- Error creating bean with name 'menuController': Injection of autowired dependency……
出现了一大串错误 Error creating bean with name 'userController': Injection of autowired dependencies failed. ...
- IE8下提示'console'没有定义错误
在开发的过程中因为调试的原因,在代码中增加console.info("xxxx"),而未进行删除 在IE8下測试该代码所在的页面报错,例如以下: 须要注意的是,使用console对 ...
随机推荐
- 糗事百科python爬虫
# -*- coding: utf-8 -*- #coding=utf-8 import urllib import urllib2 import re import thread import ti ...
- 检测字符串当中x与o的数目是否相等
题目如上 答案 function XO(str) { var arr = str.split(""), xCount = , oCount = ; var reX = /x/i, ...
- 【01】Vue 之hello wolrd
1.1. Vue简介 Vue是一个前端的双向绑定类的框架,发音[读音 /vjuː/, 类似于 view].新的Vue版本参考了React的部分设计,当然也有自己独特的地方,比如Vue的单文件组件开发方 ...
- MYSQL重复记录排除法处理方式
SELECT tmp.user_id, tmp.course_id, tmp.type, tmp.expire_time, @rownum := @rownum + 1, IF ( @course_i ...
- ORACLE的字符串操作函数
字符函数——返回字符值 这些函数全都接收的是字符族类型的参数(CHR 除外)并且返回字符值.除了特别说明的之外,这些函数大部分返回VARCHAR2类型的数值.字符函数的返回类型所受的限制和基本数据库类 ...
- BZOJ4017 小Q的无敌异或(位运算)
题目链接 小Q的无敌异或 好久之前做的这道题了……参照了别人的博客……还是没有全懂. 第一个问题维护个前缀就好了,第二个问题还要用树状数组维护…… #include <bits/stdc++.h ...
- Java微信开发以及对各种云的评价
目前一个人用Java开发一个微信的会员系统,开发已经结束,现在进入测试阶段. 有一些时间看看市面上的一些Java的微信开发视频,看了一下北风网的<微信公众平台开发Java版第一季>中的1, ...
- idea---搭建maven,tomcat入门
这篇随笔讲讲idea工具的安装和使用和在idea中搭建maven的分享. 一.概念 1.IntelliJ IDEA是什么? DEA 全称 IntelliJ IDEA,是java编程语言开发的集成环境. ...
- 基于WPF系统框架设计(9)-多值绑定之IMultiValueConverter
应用场景 我想把View层的一个布局控件和功能按钮传到ViewModel层,达到动态变更布局,同时灵活获取功能按钮的属性,让View和ViewModel完全分离,而不受View层影响. 最后我想到使用 ...
- todo提纲
deep&wide为啥work,如何优化特征:详述attention,attention在ctr预估中如何使用,din为啥work?详述transformer,如何应用于ctr预估;item2 ...