Can't initialize character set utf8 (path: /usr/share/mysql/charsets/)
【1】Can't initialize character set utf8] (path: /usr/share/mysql/charsets/)
【1.1】
报错信息:
mysql: Character set 'utf8]' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
mysql: Character set 'utf8]' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
ERROR 2019 (HY000): Can't initialize character set utf8] (path: /usr/share/mysql/charsets/)
mysql: Character set 'utf8]' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
ERROR 2019 (HY000): Can't initialize character set utf8] (path: /usr/share/mysql/charsets/)
【1.2】验证文件字符集,验证mysql支持的字符集;
查看字符串是否是mysql支持的,比如把文件放到notpad++中去查看。
或者进入mysql,查看Mysql支持的字符集有哪些(show charset;)
文件字符集:
【1.3】usr/share/mysql/charsets/Index.xml
文件:usr/share/mysql/charsets/Index.xml ,看这个文件好像并没有什么卵用。
一看就知道,无法识别解析字符,看看配置文件
【1.4】my.cnf
果然,客户端字符集设置有问题,修改好后,解决问题。
这里因为是 [client]的问题,所以不需要重启mysql,大家可以试试,实在不行再重启 Mysql。
【2】Character set 'utf-8' is not a compiled character set and is not specified
当出现“Character set 'utf-8' is not a compiled character set and is not specifie”的错误时,
将mysql安装目录下的my.ini文件的default-character-set=utf-8更改为default-character-set=utf8即可,
简单来说就是将"utf-8"更改为"utf8"即可。
【3】Mysql:Character set 'utf8mb4' is not a compiled character set ... 解决方案
连接Mysql时出现如下错误
Mysql:Character set 'utf8mb4' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
解决方法如下:
打开文件/usr/share/mysql/charsets/Index.xml
直接复制文件中utf8的配置,改为utf8mb4后,添加到文件中故障解决,更改方式如下
<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>
参考文件
字符集问题:https://blog.csdn.net/ACMAIN_CHM/article/details/4174186Character set 'utf8mb4' is not a compiled:https://blog.51cto.com/yangjingangel/1754413