Make sure Barracuda is enabled and the default character set globally is set to your desired character set in my.cnf.
ALTER DATABASE database_name CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
Of course, feel free to change the collations to what best suits you.
Then, get all of the queries to update the database tables and columns replacing the values that suit your situation:
The below query will make no changes to the database. It will query the schema and construct a list of queries for you to copy and paste that convert the collation.
SELECT CONCAT('ALTER TABLE `', table_name, '` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;') FROM information_schema.TABLES AS T, information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` AS C WHERE C.collation_name = T.table_collation AND T.table_schema = 'database_name' AND ( C.CHARACTER_SET_NAME != 'utf8mb4' OR C.COLLATION_NAME != 'utf8mb4_unicode_ci' );
If something like PHPMyAdmin is available, you can:
- Export a CSV
- Remove the quotation marks at the beginning and end of each query
- Remove the commas at the end of each query
- Copy and paste the whole file into PHPMyAdmin to run all the queries.
If you're using a different tool that lets you export as CSV then you can use that as well.