How To Solve Problems Illegal mix of collations (latin1_swedish_ci,IMPLICIT) In Laravel

Are you having database error problems “SQLSTATE [HY000]: General error: 1267 Illegal mix of collations (latin1_swedish_ci, IMPLICIT) and (utf8_unicode_ci, COERCIBLE) for operation ‘='” on laravel? If yes, solve the problem with the following solution.

Illegal Mix Of Collations Lumen Laravel

“General error: 1267 Illegal mix of collations” I experienced when trying to change the backend side of my application using the Laravel framework. This happens because the default charset and collation format on laravel are different from the charset and collation format in your database.

At lumen 5.7 (in my case), use the standard as follows

i.e. charset utf8mb4 and collation utf8mb4_unicode_ci.

You can

While the charset and collation on my database use latin1 and latin1_swedish_ci. To solve the above problem, please add DB_CHARSET and DB_COLLATION in the .env configuration

as an example

So this short tutorial will be useful

The following two tabs change content below.
This site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.

Leave a Comment

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.