MySQL Character Set & Collation Explained

Ever seen strange symbols where accented letters or emoji should be? That’s almost always a character set or collation mismatch. This guide explains both in plain terms and gives you the settings to use, so text stores and displays correctly – especially on multilingual sites and during migrations.

What is a MySQL character set?

A character set is the map that tells MySQL how to store each letter, digit, or symbol as data. Different sets can hold different characters – a limited one might handle plain English fine but mangle accented letters, non-Latin scripts, or emoji. That’s why the set you choose decides which languages your database can safely store.

What is a collation?

A collation is the set of rules for comparing and sorting those characters – how text is ordered alphabetically and whether comparisons are case sensitive. For example, a case-insensitive collation treats “Apple” and “apple” as equal, which is usually what you want for searching. Each character set has one or more collations that go with it.

For new databases, use utf8mb4 as the character set and utf8mb4_unicode_ci as the collation. This is the modern standard: it stores every language and full emoji, and it’s the default WordPress uses. (You may still see the older utf8 in guides, but it can’t store all characters – prefer utf8mb4.) A sample create command:

CREATE DATABASE IF NOT EXISTS `database_name`
DEFAULT CHARACTER SET utf8mb4
COLLATE utf8mb4_unicode_ci;

In cPanel, databases you create with Manage My Databases already use a sensible default, so you rarely need to set this by hand. You can check or change a database’s collation in phpMyAdmin under the Operations tab.

JetHost Experts Tip

Getting garbled text after a migration? The safest fix is to export from the old site, make sure both databases use utf8mb4, and re-import. Mismatched character sets between servers are the usual cause of “question mark” and mojibake characters.

Database, table, and column levels

Character set and collation can be set at three levels: the whole database, an individual table, and even a single column. A new table inherits the database’s settings unless you override them, and a column inherits the table’s. That inheritance is why simply setting the database to utf8mb4 usually isn’t enough for an old site – existing tables and columns keep their original character set until you convert them too. When you fix encoding problems, check all three levels, or convert the whole database at once in phpMyAdmin so nothing is left on an older set.

Need more help?

Still seeing broken characters? Open a ticket through Client Area → Support Tickets and our team will help you correct the encoding.