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
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南