ERROR 1115 (42000): Unknown character set: 'utf8mb4'

后端 未结 8 1900
暗喜
暗喜 2020-12-02 16:20

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

8条回答
  •  失恋的感觉
    2020-12-02 17:03

    As some suggested here, replacing utf8mb4 with utf8 will help you resolve the issue. IMHO, I used sed to find and replace them to avoid losing data. In addition, opening a large file into any graphical editor is potential pain. My MySQL data grows up 2 GB. The ultimate command is

    sed 's/utf8mb4_unicode_520_ci/utf8_unicode_ci/g' original-mysql-data.sql > updated-mysql-data.sql
    sed 's/utf8mb4/utf8/g' original-mysql-data.sql > updated-mysql-data.sql
    

    Done!

提交回复
热议问题