错误 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.
相关文章