如何查询检查 MySQL 表中列的字符集?
下面是查询 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)
广告