借助以下 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)
登录后复制
以上就是如何检查特定 MySQL 数据库中所有表的字符集以及列名?的详细内容,更多请关注每日运维网(www.mryunwei.com)其它相关文章!