How to fix ERROR 1115: Unknown character set in MySQL

MySQLINTERMEDIATEMEDIUMUpdated Dec 23, 2025ยท 236 views

MySQL error 1115 occurs when a query references a character set that your MySQL server does not recognize or support. This commonly happens with utf8mb4 on older versions, during database imports, or due to typos in charset names.

Quick fix

Fixes ERROR 1115: Unknown character set

SELECT VERSION();
  1. Check your MySQL version
  2. List available character sets on your server
  3. Check for typos in charset names
  4. Replace unsupported charset in database dumps
mysql โ€” error
SELECT VERSION();
ERROR 1115: Unknown character set

What this error means

MySQL throws error 1115 (ER_UNKNOWN_CHARACTER_SET) when it cannot map the supplied character set name to any character set compiled into the server. This error prevents the execution of DDL (CREATE TABLE, ALTER TABLE) or DML statements that specify an unsupported charset. The error typically occurs in these scenarios: - Importing a database dump created on a newer MySQL version into an older one - Using a charset that was removed in a newer MySQL version (like ucs2 being removed in MySQL 8.0) - Specifying a charset that doesn't exist on the current server installation - Simple typos in the charset name (e.g., "utf-8mb4" instead of "utf8mb4")

Typical symptoms

  • Error 1115 displayed when running CREATE TABLE or ALTER TABLE statements
  • Import of SQL dump file fails immediately with charset error
  • Application fails to connect when specifying a character set
  • Database migration from older to newer MySQL version fails during import
  • PHPMyAdmin import error when uploading database backup

Common causes

  1. MySQL version is older than 5.5.3 and utf8mb4 charset is referenced (utf8mb4 was introduced in 5.5.3)
  2. Character set was removed in newer MySQL versions (e.g., ucs2, utf16 removed in some 8.0+ builds)
  3. Typo in the character set name in SQL or connection configuration
  4. Database dump created on incompatible MySQL version with unsupported charset
  5. MySQL server compiled without support for the specified character set
  6. Mismatch between client and server character set support

How to fix "ERROR 1115: Unknown character set"

1Check your MySQL version

First, verify which MySQL version you're running. Log in to MySQL and check:

sql
SELECT VERSION();

If you're running MySQL 5.5.2 or earlier and the error mentions utf8mb4, you need to upgrade to at least 5.5.3. For other unsupported charsets, check the MySQL documentation to determine the minimum version that supports it.

2List available character sets on your server

Run this command to see all character sets supported by your MySQL server:

sql
SHOW CHARACTER SET;

This displays the complete list of available charsets. Compare the charset from your error message with this list. If it's not present, the charset is not supported on your server version.

3Check for typos in charset names

Review your SQL statements and configuration for common typos:

- Correct: utf8mb4 (no hyphens)
- Incorrect: utf-8mb4 or utf_8mb4
- Correct: utf8
- Incorrect: UTF-8 or utf-8

Character set names in MySQL are case-insensitive but must not contain hyphens. If you find typos, correct them in your SQL file, application config, or connection string.

4Replace unsupported charset in database dumps

If you're importing a dump file from a newer MySQL version, replace the unsupported charset before importing:

Using sed (Linux/macOS):

bash
sed -i 's/CHARACTER SET utf8mb4/CHARACTER SET utf8/g' dump.sql
sed -i 's/utf8mb4/utf8/g' dump.sql

Using find and replace (Windows):
Open the dump file in a text editor and use find/replace to change all instances of the charset.

Then import the modified file:

bash
mysql -u root -p database_name < dump.sql
5Upgrade MySQL if the charset should be supported

If the charset should be supported on your version but isn't, upgrade MySQL to a newer version:

Ubuntu/Debian:

bash
sudo apt-get update
sudo apt-get upgrade mysql-server

macOS (with Homebrew):

bash
brew upgrade mysql

Docker:
Update your MySQL Docker image tag to a newer version in docker-compose.yml or your Dockerfile.

After upgrading, restart MySQL and re-run your import or SQL statements.

6Specify charset in client connection

If you're connecting from an application, ensure the connection specifies a supported charset:

MySQL client:

bash
mysql -u root -p --default-character-set=utf8 database_name

Python:

python
import mysql.connector
conn = mysql.connector.connect(
  host="localhost",
  user="root",
  password="password",
  database="mydb",
  charset="utf8"
)

PHP (MySQLi):

php
$conn = new mysqli("localhost", "root", "password", "mydb");
$conn->set_charset("utf8mb4");

Node.js:

javascript
const connection = mysql.createConnection({
  host: 'localhost',
  user: 'root',
  password: 'password',
  database: 'mydb',
  charset: 'utf8mb4'
});

Advanced notes

UTF8 vs UTF8MB4:
MySQL's native "utf8" charset uses a maximum of 3 bytes per character. To support all Unicode characters (including emoji), use utf8mb4, which uses up to 4 bytes per character. utf8mb4 is compatible with MySQL 5.5.3+. Never use utf8 for new databases if you need emoji or supplementary character support.

Charset Removal in MySQL 8.0:
MySQL 8.0 removed support for several obsolete charsets like ucs2 and utf16 if they were not compiled into the binary. If you're migrating from MySQL 5.7 to 8.0 and see error 1115, convert tables to utf8mb4 before upgrading.

Configuration File Settings:
If your my.cnf or my.ini contains invalid charset directives, MySQL won't start properly. Check these variables:
- character_set_server - Must be a valid charset
- character_set_database - Must be a valid charset
- collation_server - Must match the charset

Use SHOW VARIABLES to verify:

sql
SHOW VARIABLES LIKE 'character_set%';
SHOW VARIABLES LIKE 'collation%';

Collation Compatibility:
When changing charset, ensure the collation matches. For example, utf8mb4 only works with utf8mb4_* collations, not utf8_* collations.

Frequently asked questions

What does "ERROR 1115: Unknown character set" mean?
MySQL throws error 1115 (ER_UNKNOWN_CHARACTER_SET) when it cannot map the supplied character set name to any character set compiled into the server. This error prevents the execution of DDL (CREATE TABLE, ALTER TABLE) or DML statements that specify an unsupported charset.
How do I fix "ERROR 1115: Unknown character set"?
MySQL error 1115 occurs when a query references a character set that your MySQL server does not recognize or support. This commonly happens with utf8mb4 on older versions, during database imports, or due to typos in charset names.
What causes "ERROR 1115: Unknown character set"?
MySQL version is older than 5.5.3 and utf8mb4 charset is referenced (utf8mb4 was introduced in 5.5.3) Character set was removed in newer MySQL versions (e.g., ucs2, utf16 removed in some 8.0+ builds) Typo in the character set name in SQL or connection configuration
Is the "ERROR 1115: Unknown character set" error serious?
It is a medium-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading