借助以下MySQL查询,我们可以检查特定数据库中所有表的字符集-
mysql> Select Column_name, TABLE_NAME, CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.Columns Where TABLE_SCHEMA = 'db_name';
例如,下面的查询返回所有表的字符集以及名为“ Alpha”的数据库中的列名。
mysql> Select Column_name 'Column',TABLE_NAME, CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.Columns Where TABLE_SCHEMA = 'Alpha'; +---------+------------+--------------------+ | Column | TABLE_NAME | CHARACTER_SET_NAME | +---------+------------+--------------------+ | Name | employee | latin1 | | email | employee | latin1 | | Name | student | latin1 | | RollNo | student | NULL | | Address | student | latin1 | +---------+------------+--------------------+ 5 rows in set (0.04 sec)