If you are trying to import an SQL database into phpmyAdmin and receiving the error #1273 – unknown collation ‘utf8mb4_unicode_520_ci’ then you have come to the right place!
This error was a real pain in the ass to fix because all of solutions I found on stackoverflow and on other websites did not work or caused the WordPress site to change.
The cause of this issue is when export a database from MySQL 5.5.3 or newer which uses utf8mb4 encoding to an older version that uses utf8.
The best solution is to upgrade the older version of MySQL, but this is not always an option.
Alternatively, you can use the method below to import your database without receiving the #1273 – unknown collation ‘utf8mb4_unicode_520_ci’ error.
How To Fix “unknown collation utf8mb4_unicode_520_ci” Error:
- 1. Download and install NotePad++ or a code editor of your choice.
- 2. Right-click on the database file and click on Edit with Notepad++.
- 3. Press the Ctrl key together with the F key on your keyboard to open up the Find box.
- 4. Click on the Replace tab.
- 5. In the Find what: box enter utf8mb4_unicode_520_ci
In the Replace with: box enter utf8mb4_unicode_ci
- 6. Press the Replace All button.
- 7. Save the file and import it into phpmyAdmin.
If you are getting an error saying that the Table already exists, then you will need to drop the tables that were imported on your first attempt before importing your edited version.
Did you manage to fix the annoying “unknown collation utf8mb4_unicode_520_ci” error?