logo
logo
Sign in

Illegal Mix of Collations WordPress Database Error

avatar
Nikhila

With this simple fix, our team of experts can fix the WordPress database error illegal mix of collations.


As part of our Server Management Service, we at Skynats provide answers to all questions, no matter how small.


Let's look at how our Support Team is prepared to assist clients with the resolution of the "WordPress database error: illegal mix of collations."


How to resolve the Illegal Mix of Collations WordPress Database Error


When attempting to transfer a website to a different host or upgrade software like WordPress, some of our customers have been experiencing the following error:


“WordPress database error Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE)”.


After careful consideration, our Support Techs have determined that the error is caused by a collation not being defined during database import. As a result, MySQL will use CHARSET's default collation.


Additionally, some plugins exacerbate the problem by installing tables without a defined CHARSET, resulting in a database with a jumble of various CHARSETs. Thankfully, the Support Techs have also identified a fix for the issue. All database tables must be changed to use a single CHARSET, such as UTF8 (utf8 general ci).


Changing database tables to a single CHARSET


  1. We must first export the current database and create two backup copies of it.
  2. Open one of the database backup copies after that, and use the search and replace function to change the desired CHARSET. For instance, the following would happen if we wanted to convert all tables and columns from latin8 to utf8:


Search for: CHARSET=latin8
Replace with: CHARSET=utf8



Instead of replacing them all at once, our support technicians advise replacing the CHARSETs one at a time. We must save the file after changing the CHARSETs.


  1. After that, go to phpMyAdmin and delete every table. The recently edited SQL file must then be imported into the database by selecting Import after that.
  2. The database CHARSET also needs to be changed next. This entails executing the subsequent SQL query:


ALTER DATABASE YOURDATABASENAME CHARACTER SET utf8;


Here, we must change utf8 to our preferred CHARSET and YOURDATABASENAME to the database name, including its prefix.


As an alternative, we can complete the task using phpMyAdmin by following these steps:


  1. Choose the database first, then select the Operations tab.
  2. Then, under the Collation section, choose the desired collation.
  3. Next, select the checkbox next to Change the collations of all tables.
  4. After that, select the option that appears to Change all tables' columns collations by checking the box next to it.
  5. Click the Go button to finish.


Additionally, our Support Techs advise determining whether a plugin is the root of the problem and disabling it if it is.


collect
0
avatar
Nikhila
guide
Zupyak is the world’s largest content marketing community, with over 400 000 members and 3 million articles. Explore and get your content discovered.
Read more