Error 1115 (42000): Unknown character set: 'utf8mb4'
P粉512729862
2023-08-28 11:56:56
<p>I have a MySQL dump and I'm trying to restore it using: </p>
<pre class="brush:php;toolbar:false;">mysql -u"username" -p"password" --host="127.0.0.1" mysql_db < mysql_db</pre>
<p>However, this throws the error: </p>
<pre class="brush:php;toolbar:false;">ERROR 1115 (42000) at line 3231: Unknown character set: 'utf8mb4'</pre>
<p>This is line 3231-3233: </p>
<pre class="brush:php;toolbar:false;">/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;</pre>
<p>I'm using MySQL 5.1.69. How can I resolve this error? </p>
You can try:
Open the sql file through a text editor to find and replace all
Import again.
Your version does not support this character set, I believe
5.5.3
introduced it. You should upgrade mysql to the version used to export this file.The error is obvious: you set a certain character set in the code, but your version of mysql does not support it and therefore does not know it.
Based on https://dev.mysql. com/doc/refman/5.5/en/charset-unicode-utf8mb4.html:
So maybe you could set it to utf8, close your eyes and hope, but it depends on your data and I wouldn't recommend it.