1

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

7
  • Off-topic for SO; belongs on Database Administrators Commented Oct 27, 2012 at 6:02
  • What is the default collation for your database? Commented Oct 27, 2012 at 6:06
  • My default character set is utf8 and my collate is utf8_general_ci. Commented Oct 27, 2012 at 16:16
  • This very much so makes no sense at all. I am, using the same exact class I wrote, creating tables in other databases and it is creating them with the correct data. Commented Oct 27, 2012 at 16:31
  • If you really found an answer, please, answer your question in a proper answer. You can even accept it afterwards. Commented Oct 27, 2012 at 17:45

1 Answer 1

1

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

answered May 5, 2020 at 20:47

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.