您好,欢迎访问一九零五行业门户网

mysql怎么查询表的字符集编码

mysql查询表字符集编码的两种方法:1、使用“show table status”语句查看指定数据库中指定表的字符集编码,语法“show table status from 库名 like 表名;”。2、使用“show columns”语句配合full关键字查看当前数据库中指定表所有列的字符集编码,语法“show full columns from 表名;”。
本教程操作环境:windows7系统、mysql8版本、dell g3电脑。
mysql查询表字符集编码的两种方法
1、使用show table status语句查看指定表的字符集编码
show table status命令可以获取指定数据库中每个数据表的信息,包括字符集编码。
show table status from 数据库名;
但只想获取指定表的信息,就可利用like进行限制:
show table status from 库名 like 表名;
示例:查看class_7数据库中test_info表的字符集编码
show table status from class_7 like 'test_info';
mysql> show table status from class_7 like 'test_info';+-----------+--------+---------+------------+------+----------------+-------------------------+-------------+------------+-----------------+----------+-| name | engine | version | row_format | rows | avg_row_length | data_leate_time | update_time | check_time | collation | checksum | +-----------+--------+---------+------------+------+----------------+-------------------------+-------------+------------+-----------------+----------+-| test_info | innodb | 10 | compact | 10 | 1638 | 17-12-05 19:01:55 | null | null | utf8_general_ci | null | +-----------+--------+---------+------------+------+----------------+-------------------------+-------------+------------+-----------------+----------+-1 row in set (0.00 sec)
2、使用show columns语句配合full关键字查看当前数据库中指定表中所有列的字符集编码
在mysql中,show columns命令可以显示表的列信息,而要获取有关列的更多信息,请将full关键字添加到show columns命令中:
show full columns from 表名;
该语句可以输出指定表中所有列的字符集编码
示例:查看test_info表中所有列的字符集编码
show full columns from test_info;
mysql> show full columns from test_info;+-------+----------+-----------------+------+-----+---------+-------+---------------------------------+---------+| field | type | collation | null | key | default | extra | privileges | comment |+-------+----------+-----------------+------+-----+---------+-------+---------------------------------+---------+| id | int(3) | null | no | pri | null | | select,insert,update,references | || name | char(12) | utf8_general_ci | yes | | null | | select,insert,update,references | || dorm | char(10) | utf8_general_ci | yes | | null | | select,insert,update,references | || addr | char(12) | utf8_general_ci | yes | | 未知 | | select,insert,update,references | || score | int(3) | null | yes | | null | | select,insert,update,references | |+-------+----------+-----------------+------+-----+---------+-------+---------------------------------+---------+5 rows in set (0.00 sec)
【相关推荐:mysql视频教程】
以上就是mysql怎么查询表的字符集编码的详细内容。
其它类似信息

推荐信息