How to Fix SQL Import Error #1253 in phpMyAdmin (COLLATION Issue)

If you’ve encountered the error #1253 - COLLATION 'utf8_unicode_ci' is not valid for CHARACTER SET 'utf8mb4' while uploading an SQL file in phpMyAdmin, you’re not alone.

When uploading an .sql file into phpMyAdmin, you might see this error: #1253 - COLLATION 'utf8_unicode_ci' is not valid for CHARACTER SET 'utf8mb4' This usually happens when your SQL file was created using an older character set (utf8 or utf8mb3) but you're importing it into a database that uses the newer utf8mb4character set.


Why This Happens

MySQL has two different UTF-8 character sets: utf8 or utf8mb3: The older, 3-byte version of UTF-8. utf8mb4: The newer, full 4-byte UTF-8 supporting emojis and extended characters. The collation utf8_unicode_ci (or its alias utf8mb3_unicode_ci) belongs to the older utf8 charset. MySQL doesn't allow mixing character sets and collations — you can't use a utf8 collation with utf8mb4, and vice versa.


Solution : Update Collation in the SQL File

You can manually fix this by editing your .sql file.

Steps:

  1. Open the .sql file in a text editor (like VS Code, Sublime, or Notepad++).

  2. Find and replace all instances of:

    • utf8_unicode_ciutf8mb4_unicode_ci

    • utf8 (only when referring to character set) → utf8mb4

  3. Save the file and re-import into phpMyAdmin.

0 Comment's

Add Comment

Register to Reply

About Author

Looking for a reliable and skilled web developer? I'm Bhawesh Bhaskar, a Senior Full Stack Software Developer with proven expertise in both front-end and back-end development. I provide professional website design, custom web application development, and robust PHP solutions using Laravel, CodeIgniter, and Core PHP. I help businesses create modern, responsive, and high-performance websites that drive results. Whether you're starting from scratch or need to upgrade your existing site, I deliver solutions tailored to your goals.
💼 Let’s build something great together — contact me today for a free consultation!