Mysql – What would make a MySQL database create tables in a different collation other than its default

collationMySQL

I am adding tables to a WordPress database on my localhost and it is changing my collation from utf8_general_ci to latin1_swedish_ci. I'm kinda stumped because I'm not familiar with working directly with databases since I am new to them. Could you explain why this happens?

My default character set is utf8 and my collation is utf8_general_ci.

Also, when I use the same code to create a table in other databases it works correctly.

HOLY CRAP I just now tried using wordpresses $wpdb class and it is doing the SAME THING! What the crap!

FOUND ANSWER AT WORDPRESS ANSWERS —- https://wordpress.stackexchange.com/questions/5927/default-table-collation-on-plugin-activation?rq=1

Best Answer

Finally actually adding this to the question. You must specify the COLLATION while creating the table. It will inherit the collation from the database which is latin1_swedish_ci. Wordpress sets the collation only for the connection, not for the database. E.g. for WHERE or ORDER BY clauses... See Answer and comment similar to this in link above.

hrake gets the credit not I