5

Table Name: xyz Type: InnoDB Collation:latin1_swedish_ci

Fields:

---------------------------------------------------------------------------
            Field        | Type        | Collation         | Extra        |
---------------------------------------------------------------------------
            id           | int         |                   | Primary Key  |
---------------------------------------------------------------------------
            name         | varchar     | latin1_swedish_ci |              |
---------------------------------------------------------------------------

This is my database table. And When I am trying to insert a value for name something like this

If T₀, T₁, T₂ . . . . . . . Tn represent the terms in the expansion of (x + a)n, then (T₀ - T₂ + T₄ - . . )2 + (T₁ - T₃ + T₅ - . . )2 

I get the following error:

Error Number: 1267Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='

I did a quick research & found many S.O questions and articles providing solutions but none of them worked for me.

My Reference: Visit

I tried changing the collation of the table using a query like this:

ALTER TABLE xyz CHARACTER SET utf8 COLLATE utf8_general_ci;

But the error remained still.

I also tried using utf8_unicode_ci but that also didn't work.

Reasons? Solutions? Gracias.

Sajeev C
  • 1,538
  • 4
  • 17
  • 30
  • possible duplicate of [MySQL Illegal mix of collations](http://stackoverflow.com/questions/12247120/mysql-illegal-mix-of-collations) – vhu Jun 30 '15 at 06:40

1 Answers1

9

Thanks to @vhu for marking this as duplicate.

Answer Courtesy: @Marvin W

I modified my table and that fixed my problem.

ALTER TABLE xyz CONVERT TO CHARACTER SET utf8;
Sajeev C
  • 1,538
  • 4
  • 17
  • 30
  • mysql v8.0.18 shows warning about utf8 being alias to a deprecated UTF8MB4, so giving the new charset works well: `ALTER TABLE xyz CONVERT TO CHARACTER SET UTF8MB4;` – krsoni Jul 13 '20 at 15:38