2

When I execute this query

SELECT * FROM login_table
WHERE username = 'sam'
  AND pass = AES_ENCRYPT('passabc', 'mystring') 

I keep on getting this error.

#1267 - Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='

Thanks in advance for any help

OMG Ponies
  • 325,700
  • 82
  • 523
  • 502
Parag
  • 4,754
  • 9
  • 33
  • 50

1 Answers1

-2

expicetly cast to the correct collation. google your error - there are too many descriptions out there what to do!

or change your password-field from the table to the same collation as the result from AES_ENCRYPT returns (phpMyAdmin might be useful)

santa
  • 983
  • 9
  • 30
  • I have got this solution for adding _latin1 infront of 'sam 'SELECT * FROM login_table WHERE username = _latin1'sam' AND pass = AES_ENCRYPT('passabc', 'mystring') but cant use _latin1 for pass field how to change the collation of password fiel? – Parag Jul 12 '10 at 10:13
  • just google'd "mysql change collation column"... first result: http://dev.mysql.com/doc/refman/5.0/en/charset-column.html where it describes: ALTER TABLE tablename MODIFY columnname DATATYPE CHARACTER SET latin1 COLLATE latin1_your_collation – santa Jul 13 '10 at 07:56
  • 2
    I changed the collation from "latin1_swedish_ci" to "utf8_general_ci" for the description field(varchar). & it worked thanks other way around is select * from content where desc like _latin1'%text%' – Parag Aug 18 '10 at 05:39