Reputation: 27
I am migrating a wordpress site but when I try to import the database I get the following error:
1273 - Unknown collation: 'utf8mb4_unicode_520_ci'
I think that it is caused because of the different version of MySQL, is that correct? How to fix the code below? This is how every table is created.
CREATE TABLE `wp_commentmeta` (
`meta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`comment_id` bigint(20) unsigned NOT NULL DEFAULT '0',
`meta_key` varchar(255) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`meta_value` longtext COLLATE utf8mb4_unicode_520_ci,
PRIMARY KEY (`meta_id`),
KEY `comment_id` (`comment_id`),
KEY `meta_key` (`meta_key`(191))
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
Upvotes: 0
Views: 12219
Reputation: 76
If you are using a Linux server, you can simply use the following command to change SQL file before import it into the database:
sudo sed -i 's/utf8mb4_unicode_520_ci/utf8mb4_unicode_ci/g' your_sql_file.sql
Do not forget to replace your_sql_file.sql
with path and name of your own file.
Upvotes: 1
Reputation: 571
You can solve this by finding
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
in your .sql file, and swapping it with
ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
Upvotes: 4