以下是查询以检查MySQL表的列的字符集的查询-
mysql> Select Column_name 'Column', Character_set_name 'Charset' FROM information_schema.columns where table_schema = 'db_name' and table_name ='table_name';
例如,下面的查询返回名为“ sample”的数据库中“ test_char_set”表的列名以及这些列的字符集。
mysql> Select Column_name 'Column', Character_set_name 'Charset' FROM information_schema.columns where table_schema = 'Sample' and table_name ='test_char_set'; +--------+---------+ | Column | Charset | +--------+---------+ | Name | latin1 | | Field | latin1 | +--------+---------+ 2 rows in set (0.03 sec)