溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

mysql如何查詢表的字符集編碼

發(fā)布時(shí)間:2022-06-29 09:48:00 來源:億速云 閱讀:3579 作者:iii 欄目:MySQL數(shù)據(jù)庫

這篇文章主要介紹了mysql如何查詢表的字符集編碼的相關(guān)知識(shí),內(nèi)容詳細(xì)易懂,操作簡單快捷,具有一定借鑒價(jià)值,相信大家閱讀完這篇mysql如何查詢表的字符集編碼文章都會(huì)有所收獲,下面我們一起來看看吧。

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)

mysql如何查詢表的字符集編碼

2、使用show columns語句配合full關(guān)鍵字查看當(dāng)前數(shù)據(jù)庫中指定表中所有列的字符集編碼

在mysql中,SHOW COLUMNS命令可以顯示表的列信息,而要獲取有關(guān)列的更多信息,請(qǐng)將FULL關(guān)鍵字添加到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如何查詢表的字符集編碼

關(guān)于“mysql如何查詢表的字符集編碼”這篇文章的內(nèi)容就介紹到這里,感謝各位的閱讀!相信大家對(duì)“mysql如何查詢表的字符集編碼”知識(shí)都有一定的了解,大家如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注億速云行業(yè)資訊頻道。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI