概述
本教程操作环境: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怎么查询表的字符集编码的详细内容,更多请关注靠谱客其它相关文章!
最后
以上就是动听犀牛为你收集整理的mysql怎么查询表的字符集编码的全部内容,希望文章能够帮你解决mysql怎么查询表的字符集编码所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复