Change The Collation Of A MySQL Database Dump File

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

The content of this field is kept private and will not be shown publicly.