Warning: Before beginning any conversion, please back up your database.
To see the default charset and collation for all the databases you have on the server, you can use the statement below:
SELECT SCHEMA_NAME 'database', DEFAULT_CHARACTER_SET_NAME 'charset', DEFAULT_COLLATION_NAME 'collation' FROM INFORMATION_SCHEMA.SCHEMATA;
To see the default character set and collation for a given database, use this statement:
SELECT SCHEMA_NAME 'database', DEFAULT_CHARACTER_SET_NAME 'charset', DEFAULT_COLLATION_NAME 'collation' FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'databasename';
Converting Database Charset and Collation
For WordPress sites, the recommended database charset is utf8mb4 and the recommended database collation is utf8mb4_unicode_ci. You can use these statements to change the default charset and collation for a database, or to convert the charset and collation for a table.
-- Change the default charset & collation for a database ALTER DATABASE databasename CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -- Convert for a table ALTER TABLE tablename CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;