错误 1115 (42000):未知字符集:'utf8mb4'

ERROR 1115 (42000): Unknown character set: #39;utf8mb4#39;(错误 1115 (42000):未知字符集:utf8mb4)
本文介绍了错误 1115 (42000):未知字符集:'utf8mb4'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 MySQL 转储,我试图用它来恢复:

I have a MySQL dump, which I tried to restore with:

mysql -u"username" -p"password" --host="127.0.0.1" mysql_db < mysql_db

然而,这引发了一个错误:

However, this threw an error:

ERROR 1115 (42000) at line 3231: Unknown character set: 'utf8mb4'

这是第 3231-3233 行:

This is lines 3231-3233:

/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_general_ci */ ;

我使用的是 MySQL 5.1.69.我该如何解决这个错误?

I am using MySQL 5.1.69. How can I solve this error?

推荐答案

您的版本不支持该字符集,我相信是 5.5.3 引入的.你应该将你的 mysql 升级到你用来导出这个文件的版本.

Your version does not support that character set, I believe it was 5.5.3 that introduced it. You should upgrade your mysql to the version you used to export this file.

错误很明显:您在代码中设置了某个字符集,但您的 mysql 版本不支持它,因此不知道它.

The error is then quite clear: you set a certain character set in your code, but your mysql version does not support it, and therefore does not know about it.

根据https://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html :

utf8mb4 是 utf8 的超集

utf8mb4 is a superset of utf8

所以也许你有机会把它变成 utf8,闭上眼睛并抱有希望,但这取决于你的数据,我不推荐它.

so maybe there is a chance you can just make it utf8, close your eyes and hope, but that would depend on your data, and I'd not recommend it.

这篇关于错误 1115 (42000):未知字符集:'utf8mb4'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Execute complex raw SQL query in EF6(在EF6中执行复杂的原始SQL查询)
Hibernate reactive No Vert.x context active in aws rds(AWS RDS中的休眠反应性非Vert.x上下文处于活动状态)
Bulk insert with mysql2 and NodeJs throws 500(使用mysql2和NodeJS的大容量插入抛出500)
Flask + PyMySQL giving error no attribute #39;settimeout#39;(FlASK+PyMySQL给出错误,没有属性#39;setTimeout#39;)
auto_increment column for a group of rows?(一组行的AUTO_INCREMENT列?)
Sort by ID DESC(按ID代码排序)