views:

20

answers:

2

I have a large mysql table that I think might be using the wrong character set. If so I'll need to change it using

ALTER TABLE mytable CONVERT TO CHARACTER SET utf8

But since this is a very large table, I'd rather not run this command unless I have to. So my question is, how can I ask mysql what the character set is on a particular table?

I can call status in mysql to see the database's character set, but that doesn't necessarily mean all the tables have the same character set, right?

A: 

if your table uses wrong character set, this query will break the data.
so, it must be converted another way.
if you don't want to convert, the only proper way to get correct data (i.e. tell mysql not to recode it) is SET NAMES <table charset> query. but sorting and filtering wouldn't work
to see current charset you can use SHOW CREATE TABLE query

Col. Shrapnel
+2  A: 

Try:show create table my_table;

armandino