Skip to main content

#1273 - Unknown collation: 'utf8mb4_0900_ai_ci'

Recently i had to import a db from production to localhost, so i thought this would be an easy task (Murphy's law, it never is easy when you want it). The db.gzip file was ok (no tables corruption or anything else) but it looked like my local version of Mysql (Server version: 5.7.26 MySQL Community Server (GPL)) was using a different utf8mb4 collation from the production live server (Server version: 8.0.20-0ubuntu0.20.04.1 (Ubuntu)). So the server collation was using utf8mb4_0900_ai_ci vs the local collation utf8mb4_unicode_ci. Turned out all i had to do in order not to upgrade mysql server was this macOS terminal command.

sed -i '' 's/utf8mb4_0900_ai_ci/utf8mb4_unicode_ci/g' db.sql 

 

utf8mb4