Posts Tagged ‘errors’

Illegal Mix of Collations using CONCAT

Friday, September 4th, 2009

While using MySQL5, I came across this error:

Illegal mix of collations (utf8_general_ci,COERCIBLE) and (latin1_swedish_ci,IMPLICIT) for operation ‘concat’

When I took a look at the query statement, I realized that I was doing a CONCAT with an IF statement being the first part.

EG:
CONCAT(If(1=1,'true','false),' : ',columnb) as variable

This post by Vahid Ghafarpour on Illegal Mix of Collations helped me out when I tried to change the character sets of the database, but I realized that it might be a server default causing this.
Since I didn’t want to change the statement, I changed the query. (I suppose it’s bad practice. :( )

Based on this post at Experts Exchange on the Illegal Mix of Collations, I added COLLATE latin1_swedish_ci after the string. Now, THIS didn’t work:

CONCAT(If(1=1,'true','false),' : ',columnb) as variable COLLATE latin1_swedish_ci
You’ll see why it didn’t work in a second.
CONCAT(If(1=1,'true','false),' : ',columnb) COLLATE latin1_swedish_ci as variable
Didn’t work as well.

What worked is below:
CONCAT(If(1=1,'true','false) COLLATE latin1_swedish_ci ,' : ',columnb) as variable
This is because it’s the IF statement that left its type ambiguous.

Stay cool, coders!

(13) Permission denied: FastCGI can’t create server (problem solved)

Friday, August 7th, 2009

I was getting the following error on my Red Hat Enterprise Linux 5 server.  (RHEL 5)

[Thu Aug 06 17:48:03 2009] [crit] (13)Permission denied: FastCGI:
can’t create server “(Fast CGI File)”: bind() failed [(location of FastCGI location)]

I fixed this by:

chmod o+x /parent/directory/of/fastcgi

EG:
If Fast CGI was /var/log/httpd/fastcgi,
I’d do chmod o+x /var/log/httpd.

Worked fine.  (Kudos to my coworker who originally proposed the idea and it worked– Mentioning it again ’cause I did it again.)

Did it help you? Leave a comment! :)