[SOLVED] Mysql error – Unknown collation: ‘utf8mb4_unicode_ci’

You have this issue because your server run an older versions of MySQL.

Open your sql script to import with a text editor and replace the collation from utf8mb4/utf8mb4_unicode_ci to utf8/utf8_general_ci

If you use linux, you can do it via shell

sed -i 's/utf8mb4/utf8/g' your_file.sql
sed
-i 's/utf8_unicode_ci/utf8_general_ci/g' your_file.sql
sed
-i 's/utf8_unicode_520_ci/utf8_general_ci/g' your_file.sql


and before load the script, create the database with the  command


CREATE DATABASE mydb CHARACTER SET utf8 COLLATE utf8_general_ci;

If your sql script is for WordPress,  remember to change in wp-config.php:

define(‘DB_CHARSET’, ‘utf8mb4’);

to

define(‘DB_CHARSET’, ‘utf8’);

and also don’t forget to modify DB_COLLATE with

define(‘DB_COLLATE’, ‘utf8_general_ci’); 
Source: [SOLVED] Mysql error – Unknown collation: ‘utf8mb4_unicode_ci’

Leave a Reply

Your email address will not be published. Required fields are marked *