Am getting the below error when trying to do a select through a stored procedure in MySQL.
Illegal mix of collations (latin1_general_cs,IMPLICIT) and
If the columns that you are having trouble with are "hashes", then consider the following...
If the "hash" is a binary string, you should really use BINARY(...)
datatype.
If the "hash" is a hex string, you do not need utf8, and should avoid such because of character checks, etc. For example, MySQL's MD5(...)
yields a fixed-length 32-byte hex string. SHA1(...)
gives a 40-byte hex string. This could be stored into CHAR(32) CHARACTER SET ascii
(or 40 for sha1).
Or, better yet, store UNHEX(MD5(...))
into BINARY(16)
. This cuts in half the size of the column. (It does, however, make it rather unprintable.) SELECT HEX(hash) ...
if you want it readable.
Comparing two BINARY
columns has no collation issues.