Change The Collation Of A MySQL Database Dump File
6th July 2025
To change the collation of a MySQL database dump file use the following.
sed -i 's/utf8mb4_0900_ai_ci/utf8_general_ci/g' database_file.sql
sed -i 's/CHARSET=utf8mb4/CHARSET=utf8/g' database_file.sql
sed -i 's/COLLATE=utf8mb4_general_ci/COLLATE=utf8_unicode_ci/g' database_file.sql
Use this if you see errors such as "Unknown collation: 'utf8mb4_0900_ai_ci'".
Add new comment