mysql查詢表字符集編碼的兩種方法:1、使用“show table status”語句查看指定數(shù)據(jù)庫中指定表的字符集編碼,語法“show table status from 庫名 like 表名;”。2、使用“show columns”語句配合full關(guān)鍵字查看當(dāng)前數(shù)據(jù)庫中指定表所有列的字符集編碼,語法“show full columns from 表名;”。
本教程操作環(huán)境:windows7系統(tǒng)、mysql8版本、Dell G3電腦。
mysql查詢表字符集編碼的兩種方法
1、使用show table status
語句查看指定表的字符集編碼
SHOW TABLE STATUS
命令可以獲取指定數(shù)據(jù)庫中每個(gè)數(shù)據(jù)表的信息,包括字符集編碼。
show table status from 數(shù)據(jù)庫名;
但只想獲取指定表的信息,就可利用like進(jìn)行限制:
show table status from 庫名 like 表名;
示例:查看class_7數(shù)據(jù)庫中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關(guān)鍵字查看當(dāng)前數(shù)據(jù)庫中指定表中所有列的字符集編碼
在mysql中,SHOW COLUMNS
命令可以顯示表的列信息,而要獲取有關(guān)列的