1

I am trying this:

SET @query1 =  'star';
   SELECT *
   FROM businesses
   WHERE business_name LIKE @query1

But i get following error:

Error Code: 1267 Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation 'like'

What am I doing wrong?

6
  • can you please tell your mysql version. Commented Nov 22, 2014 at 12:41
  • I have just checked in phpmyadmin and it is working. Commented Nov 22, 2014 at 12:42
  • @S.M.Mohiuddin - Server version: 5.5.40-cll Commented Nov 22, 2014 at 12:42
  • @AmitGarg - i am trying to use this in phpMyAdmin. It is not working Commented Nov 22, 2014 at 12:43
  • This Link help you Commented Nov 22, 2014 at 12:48

2 Answers 2

3

Just specify the collation

SELECT * FROM businesses WHERE business_name LIKE @query1 COLLATE utf8_unicode_ci

For a more permanent fix you need to change the collation of the server to be compatible with the db or viceversa.I dont have much experience in collations so you have do to a bit of reading.

Docs

Sign up to request clarification or add additional context in comments.

Comments

0

weird.. but you can convert your table to that charset like:

ALTER TABLE mydb.businesses  DEFAULT COLLATE utf8_unicode_ci;
ALTER TABLE mydb.businesses CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.