Character set problems in WordPress show up as garbled text such as é or ’, question marks where Hindi or emoji should be, or an import that stops with Unknown collation: 'utf8mb4_0900_ai_ci'. The fix is the same in every case: store and read everything as utf8mb4. This guide shows how to check your database, convert old tables safely and import a MySQL 8.0 dump on a MariaDB server.
Set DB_CHARSET to utf8mb4 in wp-config.php, find tables still using latin1 or the old 3-byte utf8, and convert them with ALTER TABLE … CONVERT TO CHARACTER SET utf8mb4 after a full backup. If an import from a MySQL 8.0 server fails with utf8mb4_0900_ai_ci, replace that collation with utf8mb4_unicode_520_ci in the dump. A "missing MySQL extension" error is a different problem: it comes from the PHP version or a very old WordPress, not from the character set.
1. Character sets in two minutes
A character set decides how text is stored as bytes; a collation decides how text is compared and sorted.
| Character set | What it stores | Use it? |
|---|---|---|
| latin1 | Western European letters only | No, for any new data |
| utf8 or utf8mb3 | Most Unicode, but only up to 3 bytes per character, so no emoji | No; convert away from it |
| utf8mb4 | All of Unicode, including emoji and every Indian script | Yes, everywhere |
WordPress has used utf8mb4 by default since version 4.2 and converts its own tables to it during a database upgrade when the server supports it. Problems come from sites that were built before that, tables created by plugins, and databases moved between servers.
2. Which server are you on?
The title of this article mentions MySQL 8.0, but a database server can be MySQL or MariaDB. Our cPanel and DirectAdmin shared servers run MariaDB. To see the exact version, open phpMyAdmin and read Server version in the Database server panel on the right. It matters for one error in particular: MySQL 8.0 names its default collation utf8mb4_0900_ai_ci, and MariaDB does not recognise that name.
3. Symptoms and what they mean
| Symptom | Likely cause | Section |
|---|---|---|
| é, ’ or similar in posts | Text stored in one character set and read as another | 5 and 6 |
| Emoji or some characters become ???? | Table or column is latin1 or utf8mb3 | 5 |
| Unknown collation utf8mb4_0900_ai_ci on import | Dump made on MySQL 8.0, imported into MariaDB | 7 |
| Your PHP installation appears to be missing the MySQL extension | Not a charset problem; see section 8 | 8 |
| Error establishing a database connection | Wrong credentials, host or database name; not a charset problem | 8 |
4. Back up first
Every step below rewrites tables. Before you start:
- Export the database in phpMyAdmin (select it, Export, format SQL) and keep the file on your computer. See How to back up a MySQL database using phpMyAdmin.
- Or use JetBackup in cPanel or DirectAdmin to download a recent backup. Included backups are weekly, so your own export is the most recent copy. See Backup and restore with JetBackup.
5. Check and convert your tables
- Set the connection character set.Edit
wp-config.phpwith File Manager and make sure these two lines read:define( 'DB_CHARSET', 'utf8mb4' );anddefine( 'DB_COLLATE', '' );. An emptyDB_COLLATElets WordPress pick the best utf8mb4 collation the server supports. - Find tables that are not utf8mb4.In phpMyAdmin, select your WordPress database, open the SQL tab and run the first query below. Any table listed needs converting.
- Generate the conversion statements.Run the second query below. It writes one
ALTER TABLEline per table that needs it. - Run the statements.Copy the results back into the SQL tab and run them. Large tables can take a while; if one times out, run it again on its own.
- Change the database default.Run the
ALTER DATABASEline below, so tables that plugins create later also use utf8mb4. - Check the site.Open posts and pages with accented text, Indian scripts or emoji. If text now looks garbled, restore your backup and read section 6.
Query for step 2:
SELECT TABLE_NAME, TABLE_COLLATION
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_COLLATION NOT LIKE 'utf8mb4%';Query for step 3:
SELECT CONCAT('ALTER TABLE `', TABLE_NAME,
'` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;')
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_COLLATION NOT LIKE 'utf8mb4%';Statement for step 5 (replace the name with your database):
ALTER DATABASE `cpaneluser_wp` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;If jailed SSH is enabled on your account, WP-CLI can do the export for you with wp db export before you start. SSH is off by default; ask support to turn it on.
6. When conversion makes text worse
CONVERT TO CHARACTER SET assumes the bytes in a table really are in the table's declared character set. On old sites, UTF-8 text was often saved into latin1 tables. The page looked right, because it was written and read the same wrong way, but converting such a table encodes the text twice and turns it into é-style garbage.
If that happens, restore your backup and don't run the conversion again. Fixing double-encoded data means converting each text column to a binary type and then to utf8mb4, column by column, and it is easy to get wrong. Test it on a copy of the database, or ask a developer. Tools such as the "Better Search Replace" plugin cannot fix the encoding itself.
7. Importing a MySQL 8.0 dump into MariaDB
A dump exported from MySQL 8.0 often contains utf8mb4_0900_ai_ci, which MariaDB rejects with Unknown collation. Fix the file before you import it:
- Open the dump in a plain-text editorthat handles large files, such as VS Code or Notepad++.
- Replace every
utf8mb4_0900_ai_ciwithutf8mb4_unicode_520_ci. - Save and import againin phpMyAdmin. On cPanel, phpMyAdmin accepts files up to 50 MB; compress the dump as
.sql.gzif it is larger.
For other import errors, see Database troubleshooting.
8. Errors that are not about character sets
"Your PHP installation appears to be missing the MySQL extension which is required by WordPress." WordPress needs PHP's mysqli extension. The error appears when a very old WordPress, which used the mysql_* functions removed in PHP 7, runs on a modern PHP, or when the selected PHP version doesn't load mysqli. Update WordPress, and choose a current PHP version in your control panel. Don't downgrade PHP to make it go away: old PHP versions no longer receive security fixes.
"Error establishing a database connection." WordPress can't log in to the database. Check the database name, user, password and host in wp-config.php. See Troubleshooting "Error establishing a database connection".
9. Where Domain India fits
Domain India shared hosting includes MariaDB databases managed with phpMyAdmin, a choice of PHP versions in the control panel, and weekly JetBackup 5 backups on cPanel and DirectAdmin. For a new WordPress site, see WordPress hosting, or start with a cPanel plan:
- 25 GB NVMe SSD Storage
- 50 GB Monthly Bandwidth
- 1 Website
- 10 Email Accounts
The card shows the live Domain India price, excluding 18% GST.
Which character set should a WordPress database use?
utf8mb4, for the database, every table and the connection. Set DB_CHARSET to utf8mb4 in wp-config.php. Unlike latin1, it stores Indian scripts, and unlike the old 3-byte utf8, it also stores emoji.
How do I fix "Unknown collation: utf8mb4_0900_ai_ci" when importing?
The dump was made on MySQL 8.0 and the target server runs MariaDB, which does not know that collation. Replace utf8mb4_0900_ai_ci with utf8mb4_unicode_520_ci in the dump file and import it again.
Does a character set problem cause the "missing MySQL extension" error?
No. That error means PHP cannot find the mysqli extension WordPress needs, usually because a very old WordPress is running on modern PHP. Update WordPress and choose a current PHP version in your control panel.
Is it safe to convert WordPress tables to utf8mb4?
It is safe for tables whose data really is in their declared character set, which is most of them. Always export a backup first. If text looks garbled after converting, the data was double-encoded; restore the backup and fix those columns separately.
Which MySQL version do Domain India shared servers use?
Our cPanel and DirectAdmin shared servers run MariaDB. The exact version is shown as Server version on the phpMyAdmin home page.
What should DB_COLLATE be in wp-config.php?
Leave it empty. WordPress then chooses the best utf8mb4 collation the database server supports.
Ready to fix your database? Take a backup, then open phpMyAdmin from your hosting services. If the conversion goes wrong or you're unsure, open a support ticket with the database name and the error you see.
Tell us the database name, the exact error and what you were doing, and our team will help you find the cause.
Open a support ticket