40101 set names utf8mb4

Primary tabs


unknown character set ‘utf8mb4’ mysql import

Если вы наблюдаете такую ошибку, то скорее всего дело в том, что ваша версию MySQL просто не поддерживает кодировку utf8mb4, которая является расширением utf8.

Вполне возможно, что для импорта базы вам будет достаточно и utf8 (надо пробовать — особенно если не хочется переустаналивать сервер) — а потому попробуйте изменить в файле дампа (обычна эта инструкция идет где-то в начале):

Короче — в установках кодироки просто замените все utf8mb4 на utf8.

I have a MySQL dump, which I tried to restore with:

However, this threw an error:

This is lines 3231-3233:

I am using MySQL 5.1.69. How can I solve this error?

8 Answers 8

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.

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.

utf8mb4 is a superset of 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.

Open sql file by text editor find and replace all

PHPMyAdmin has the same MySQL compatibility mode in the ‘expert’ export options. Although that has on occasions done nothing.

If you don’t have access via the command line or via PHPMyAdmin then editing the

bit to read ‘utf8’ only, is the way to go.

Just open your sql file with a text editor and search for ‘utf8mb4’ and replace with utf8.I hope it would work for you

I am answering the question — as I didn’t find any of them complete. As nowadays Unknown character set: ‘utf8mb4’ is quite prevalent as lot of deployments have MySQL less then 5.5.3 (version in which utf8mb4 was added).

The error clearly states that you don’t have utf8mb4 supported on your stage db server.

Cause: probably locally you have MySQL version 5.5.3 or greater, and on stage/hosted VPS you have MySQL server version less then 5.5.3

The utf8mb4 character sets was added in MySQL 5.5.3.

utf8mb4 was added because of a bug in MySQL’s utf8 character set. MySQL’s handling of the utf8 character set only allows a maximum of 3 bytes for a single codepoint, which isn’t enough to represent the entirety of Unicode (Maximum codepoint = 0x10FFFF ). Because they didn’t want to potentially break any stuff that relied on this buggy behaviour, utf8mb4 was added. Documentation here.

Verification: To verify you can check the current character set and collation for the DB you’re importing the dump from — How do I see what character set a MySQL database / table / column is?

Solution 1: Simply upgrade your MySQL server to 5.5.3 (at-least) — for next time be conscious about the version you use locally, for stage, and for prod, all must have to be same. A suggestion — in present the default character set should be utf8mb4.

Solution 2 (not recommended): Convert the current character set to utf8, and then export the data — it’ll load ok.

— База данных: `movnum_me`

— ———————————————————

— Структура таблицы `wp_aiowps_events`

CREATE TABLE IF NOT EXISTS `wp_aiowps_events` (

`event_type` VARCHAR( 150 ) NOT NULL DEFAULT »,
`username` VARCHAR( 150 ) DEFAULT NULL ,
`user_id` BIGINT( 20 ) DEFAULT NULL ,
`event_date` DATETIME NOT NULL DEFAULT ‘0000-00-00 00:00:00’,
`ip_or_host` VARCHAR( 100 ) DEFAULT NULL ,
`referer_info` VARCHAR( 255 ) DEFAULT NULL ,
`event_data` LONGTEXT,
PRIMARY KEY ( `id` )

Ответ MySQL: Документация

#1115 — Unknown character set: ‘utf8mb4’

Оцените статью
Все о Windows 10
Добавить комментарий

Не копируйте текст!