I have 8 tables with many fields in them all created with Latin charset.
I want to convert all of them into UTF-8.
For database and tables, I can do it manually.
How do I do it for fields programatically?
I have 8 tables with many fields in them all created with Latin charset.
I want to convert all of them into UTF-8.
For database and tables, I can do it manually.
How do I do it for fields programatically?
I would like to recommend information_schema.columns.
This is a very useful view.
To get list of the columns not in UTF-8:-
select table_schema, table_name, column_name, character_set_name, collation_name
from information_schema.columns
where table_schema in ('YOUR_DB') and collation_name not like 'utf8%';
select table_schema, table_name, column_name, character_set_name, collation_name
from information_schema.columns
where table_schema in ('YOUR_DB') and character_set_name not like 'utf8%';
The best thing about this view ... it also include the data type for the column (refer to COLUMN_TYPE in the doc), default value (refer to COLUMN_DEFAULT) and etc ...
with all these information, I think is pretty easy to make use on a programming language to construct the relevant SQL (and execute it)