Every new database created on a cPanel host inherits the server’s default character set and collation. On a default cPanel install with MariaDB, that’s usually utf8mb3 (formerly utf8) with utf8_general_ci — a three-byte UTF-8 subset that can’t represent emoji and a collation that ignores case. Every new WordPress install starts with this and quietly truncates four-byte characters from comments and post content. Changing the server default makes new databases sane; the existing ones still need the migration article.
What’s happening
MySQL collation lives at four levels: server, database, table, column. Each new layer inherits from the one above unless explicitly overridden. The server-wide defaults are set by character_set_server and collation_server. cPanel doesn’t customize these on install, so they’re whatever MariaDB/MySQL ships with — historically latin1, then utf8mb3 on modern builds.
When an application like WordPress runs CREATE DATABASE acmecorp_wp without specifying a charset, MariaDB uses the server default. WordPress’s installer then runs ALTER DATABASE ... CHARACTER SET utf8mb4 if you’ve configured it correctly in wp-config.php — but a lot of installs don’t, and the database stays on the server default. Tables created within that database then inherit the database default, propagating the wrong charset down.
How to verify
mysql -e "SHOW VARIABLES LIKE 'character_set_server'"
mysql -e "SHOW VARIABLES LIKE 'collation_server'"
mysql -e "SHOW VARIABLES LIKE 'character_set_database'"
mysql -e "SELECT SCHEMA_NAME, DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA"
mysql -e "SHOW COLLATION WHERE Charset='utf8mb4'"
The first three show server-wide state. The schemata query shows what every existing database inherited. The collation list helps you pick a target (utf8mb4_unicode_ci and utf8mb4_0900_ai_ci are the modern choices).
The fix
- Pick the right defaults. For new builds today,
utf8mb4withutf8mb4_unicode_ci(MariaDB) orutf8mb4_0900_ai_ci(MySQL 8.x) are the right choice.unicode_ciis broadly compatible and case-insensitive._binvariants are strict-binary; only use them if you have specific case-sensitive needs. - Set persistently in
/etc/my.cnf.d/cpanel.cnf:
The[mysqld] character_set_server = utf8mb4 collation_server = utf8mb4_unicode_ci [client] default-character-set = utf8mb4 [mysql] default-character-set = utf8mb4[client]and[mysql]sections set defaults for command-line clients so that exports and imports use the right charset. - Restart MySQL. New databases now default to utf8mb4. Existing ones don’t change — that’s the utf8mb4 migration article.
- Verify by creating a test database:
Should showmysql -e "CREATE DATABASE charset_test" mysql -e "SHOW CREATE DATABASE charset_test"DEFAULT CHARACTER SET utf8mb4. Drop it:mysql -e "DROP DATABASE charset_test". - For new cPanel accounts created after this change, every database the customer creates inherits utf8mb4. WordPress’s standard config (
DB_CHARSET = 'utf8mb4'inwp-config.php) now matches the database default and there’s nothing to fix. - For mixed environments where some apps need legacy charsets (rare but happens), set the server default to utf8mb4 and override per-database for the legacy app:
Most apps don’t actually need legacy charsets; the apps that claim they do usually mean “the dump was in latin1” — which is a one-time conversion problem.ALTER DATABASE acmecorp_legacy CHARACTER SET latin1 COLLATE latin1_swedish_ci; - For phpMyAdmin’s connection collation (top-right dropdown), set it to
utf8mb4_unicode_ciin/usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php:
Without this, exports run from phpMyAdmin can lose four-byte characters even on a utf8mb4 database.$cfg['DefaultConnectionCollation'] = 'utf8mb4_unicode_ci';
For takeover environments where the server default has never been corrected and customer issues with emoji or non-ASCII keep recurring, Stack Harbor’s managed cPanel operations team sets the server-wide default during intake and schedules the per-database conversion as a follow-up.