information_schema系列之字符集校驗(CHARACTER_SETS,COLLATIONS,COLLATION_CHARACTER_SET_APPLICABILITY)
阿新 • • 發佈:2018-12-15
information_schema系列之字符集校驗(CHARACTER_SETS,COLLATIONS,COLLATION_CHARACTER_SET_APPLICABILITY)
1:CHARACTER_SETS 首先看一下查詢前十條的結果:[email protected] [information_schema]>select * from CHARACTER_SETS order by MAXLEN DESC limit 10; +--------------------+----------------------+---------------------------------+--------+ | CHARACTER_SET_NAME | DEFAULT_COLLATE_NAME | DESCRIPTION | MAXLEN | +--------------------+----------------------+---------------------------------+--------+ | utf32 | utf32_general_ci | UTF-32 Unicode | 4 | | utf16le | utf16le_general_ci | UTF-16LE Unicode | 4 | | gb18030 | gb18030_chinese_ci | China National Standard GB18030 | 4 | | utf8mb4 | utf8mb4_general_ci | UTF-8 Unicode | 4 | | utf16 | utf16_general_ci | UTF-16 Unicode | 4 | | eucjpms | eucjpms_japanese_ci | UJIS for Windows Japanese | 3 | | ujis | ujis_japanese_ci | EUC-JP Japanese | 3 | | utf8 | utf8_general_ci | UTF-8 Unicode | 3 | | gbk | gbk_chinese_ci | GBK Simplified Chinese | 2 | | ucs2 | ucs2_general_ci | UCS-2 Unicode | 2 | +--------------------+----------------------+---------------------------------+--------+
看一下官方給的解釋:
INFORMATION_SCHEMA Name | SHOW Name | Remarks |
CHARACTER_SET_NAME | Charset字符集 | |
DEFAULT_COLLATE_NAME | Default collation預設排序 | |
DESCRIPTION | Description描述 | MySQL extension |
MAXLEN | Maxlen最大長度,位元組數 | MySQL extension |
| CHARACTER_SETS | CREATE TEMPORARY TABLE `CHARACTER_SETS` ( `CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '', `DEFAULT_COLLATE_NAME` varchar(32) NOT NULL DEFAULT '', `DESCRIPTION` varchar(60) NOT NULL DEFAULT '', `MAXLEN` bigint(3) NOT NULL DEFAULT '0' ) ENGINE=MEMORY DEFAULT CHARSET=utf8 |
我們可以看到,ENGINE=MEMORY預設的引擎是memory的,也就是每次重啟會重新生成一個一模一樣的表
2:COLLATIONS 首先看一下查詢前十條的結果:[email protected] [information_schema]>select * from COLLATIONS order by id limit 10; +-------------------+--------------------+----+------------+-------------+---------+ | COLLATION_NAME | CHARACTER_SET_NAME | ID | IS_DEFAULT | IS_COMPILED | SORTLEN | +-------------------+--------------------+----+------------+-------------+---------+ | big5_chinese_ci | big5 | 1 | Yes | Yes | 1 | | latin2_czech_cs | latin2 | 2 | | Yes | 4 | | dec8_swedish_ci | dec8 | 3 | Yes | Yes | 1 | | cp850_general_ci | cp850 | 4 | Yes | Yes | 1 | | latin1_german1_ci | latin1 | 5 | | Yes | 1 | | hp8_english_ci | hp8 | 6 | Yes | Yes | 1 | | koi8r_general_ci | koi8r | 7 | Yes | Yes | 1 | | latin1_swedish_ci | latin1 | 8 | Yes | Yes | 1 | | latin2_general_ci | latin2 | 9 | Yes | Yes | 1 | | swe7_swedish_ci | swe7 | 10 | Yes | Yes | 1 | +-------------------+--------------------+----+------------+-------------+---------+
老規矩,貼一下官方解釋:
INFORMATION_SCHEMA Name | SHOW Name | Remarks |
COLLATION_NAME | Collation 連線校對 | |
CHARACTER_SET_NAME | Charset對應的字符集 | MySQL extension |
ID | Id排序第幾個,這個應該是MySQL自己編排的,不深究 | MySQL extension |
IS_DEFAULT | Default 表示的字符集是否被編譯到伺服器 |
MySQL extension |
IS_COMPILED | Compiled 涉及的儲存器中的字符集表達的字串進行排序所需的量。 |
MySQL extension |
SORTLEN | Sortlen 涉及的儲存器中的字符集表達的字串進行排序所需的量。 |
MySQL extension |
------------------------------------------------------------------------------------------------------------+ | COLLATIONS | CREATE TEMPORARY TABLE `COLLATIONS` ( `COLLATION_NAME` varchar(32) NOT NULL DEFAULT '', `CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '', `ID` bigint(11) NOT NULL DEFAULT '0', `IS_DEFAULT` varchar(3) NOT NULL DEFAULT '', `IS_COMPILED` varchar(3) NOT NULL DEFAULT '', `SORTLEN` bigint(3) NOT NULL DEFAULT '0' ) ENGINE=MEMORY DEFAULT CHARSET=utf8 | +------------+-------------------------------------------------------
記憶體表,系統自動生成,不會改變。 3:COLLATION_CHARACTER_SET_APPLICABILITY 看一下前十條資料,我們根據條件查詢一下。
[email protected] [information_schema]>select * from COLLATION_CHARACTER_SET_APPLICABILITY where CHARACTER_SET_NAME like '%utf%' limit 10; +-------------------+--------------------+ | COLLATION_NAME | CHARACTER_SET_NAME | +-------------------+--------------------+ | utf8_general_ci | utf8 | | utf8_bin | utf8 | | utf8_unicode_ci | utf8 | | utf8_icelandic_ci | utf8 | | utf8_latvian_ci | utf8 | | utf8_romanian_ci | utf8 | | utf8_slovenian_ci | utf8 | | utf8_polish_ci | utf8 | | utf8_estonian_ci | utf8 | | utf8_spanish_ci | utf8 | +-------------------+--------------------+ 10 rows in set (0.00 sec)
老規矩,貼一下官方解釋:
INFORMATION_SCHEMA Name | SHOW Name | Remarks |
COLLATION_NAME | Collation | |
CHARACTER_SET_NAME | Charset |
[email protected] [information_schema]>select * from CHARACTER_SETS order by MAXLEN DESC limit 10; +--------------------+----------------------+---------------------------------+--------+ | CHARACTER_SET_NAME | DEFAULT_COLLATE_NAME | DESCRIPTION | MAXLEN | +--------------------+----------------------+---------------------------------+--------+ | utf32 | utf32_general_ci | UTF-32 Unicode | 4 | | utf16le | utf16le_general_ci | UTF-16LE Unicode | 4 | | gb18030 | gb18030_chinese_ci | China National Standard GB18030 | 4 | | utf8mb4 | utf8mb4_general_ci | UTF-8 Unicode | 4 | | utf16 | utf16_general_ci | UTF-16 Unicode | 4 | | eucjpms | eucjpms_japanese_ci | UJIS for Windows Japanese | 3 | | ujis | ujis_japanese_ci | EUC-JP Japanese | 3 | | utf8 | utf8_general_ci | UTF-8 Unicode | 3 | | gbk | gbk_chinese_ci | GBK Simplified Chinese | 2 | | ucs2 | ucs2_general_ci | UCS-2 Unicode | 2 | +--------------------+----------------------+---------------------------------+--------+
看一下官方給的解釋:
INFORMATION_SCHEMA Name | SHOW Name | Remarks |
CHARACTER_SET_NAME | Charset字符集 | |
DEFAULT_COLLATE_NAME | Default collation預設排序 | |
DESCRIPTION | Description描述 | MySQL extension |
MAXLEN | Maxlen最大長度,位元組數 | MySQL extension |
| CHARACTER_SETS | CREATE TEMPORARY TABLE `CHARACTER_SETS` ( `CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '', `DEFAULT_COLLATE_NAME` varchar(32) NOT NULL DEFAULT '', `DESCRIPTION` varchar(60) NOT NULL DEFAULT '', `MAXLEN` bigint(3) NOT NULL DEFAULT '0' ) ENGINE=MEMORY DEFAULT CHARSET=utf8 |
我們可以看到,ENGINE=MEMORY預設的引擎是memory的,也就是每次重啟會重新生成一個一模一樣的表
2:COLLATIONS 首先看一下查詢前十條的結果:[email protected] [information_schema]>select * from COLLATIONS order by id limit 10; +-------------------+--------------------+----+------------+-------------+---------+ | COLLATION_NAME | CHARACTER_SET_NAME | ID | IS_DEFAULT | IS_COMPILED | SORTLEN | +-------------------+--------------------+----+------------+-------------+---------+ | big5_chinese_ci | big5 | 1 | Yes | Yes | 1 | | latin2_czech_cs | latin2 | 2 | | Yes | 4 | | dec8_swedish_ci | dec8 | 3 | Yes | Yes | 1 | | cp850_general_ci | cp850 | 4 | Yes | Yes | 1 | | latin1_german1_ci | latin1 | 5 | | Yes | 1 | | hp8_english_ci | hp8 | 6 | Yes | Yes | 1 | | koi8r_general_ci | koi8r | 7 | Yes | Yes | 1 | | latin1_swedish_ci | latin1 | 8 | Yes | Yes | 1 | | latin2_general_ci | latin2 | 9 | Yes | Yes | 1 | | swe7_swedish_ci | swe7 | 10 | Yes | Yes | 1 | +-------------------+--------------------+----+------------+-------------+---------+
老規矩,貼一下官方解釋:
INFORMATION_SCHEMA Name | SHOW Name | Remarks |
COLLATION_NAME | Collation 連線校對 | |
CHARACTER_SET_NAME | Charset對應的字符集 | MySQL extension |
ID | Id排序第幾個,這個應該是MySQL自己編排的,不深究 | MySQL extension |
IS_DEFAULT | Default 表示的字符集是否被編譯到伺服器 |
MySQL extension |
IS_COMPILED | Compiled 涉及的儲存器中的字符集表達的字串進行排序所需的量。 |
MySQL extension |
SORTLEN | Sortlen 涉及的儲存器中的字符集表達的字串進行排序所需的量。 |
MySQL extension |
------------------------------------------------------------------------------------------------------------+ | COLLATIONS | CREATE TEMPORARY TABLE `COLLATIONS` ( `COLLATION_NAME` varchar(32) NOT NULL DEFAULT '', `CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '', `ID` bigint(11) NOT NULL DEFAULT '0', `IS_DEFAULT` varchar(3) NOT NULL DEFAULT '', `IS_COMPILED` varchar(3) NOT NULL DEFAULT '', `SORTLEN` bigint(3) NOT NULL DEFAULT '0' ) ENGINE=MEMORY DEFAULT CHARSET=utf8 | +------------+-------------------------------------------------------
記憶體表,系統自動生成,不會改變。 3:COLLATION_CHARACTER_SET_APPLICABILITY 看一下前十條資料,我們根據條件查詢一下。
[email protected] [information_schema]>select * from COLLATION_CHARACTER_SET_APPLICABILITY where CHARACTER_SET_NAME like '%utf%' limit 10; +-------------------+--------------------+ | COLLATION_NAME | CHARACTER_SET_NAME | +-------------------+--------------------+ | utf8_general_ci | utf8 | | utf8_bin | utf8 | | utf8_unicode_ci | utf8 | | utf8_icelandic_ci | utf8 | | utf8_latvian_ci | utf8 | | utf8_romanian_ci | utf8 | | utf8_slovenian_ci | utf8 | | utf8_polish_ci | utf8 | | utf8_estonian_ci | utf8 | | utf8_spanish_ci | utf8 | +-------------------+--------------------+ 10 rows in set (0.00 sec)
老規矩,貼一下官方解釋:
INFORMATION_SCHEMA Name | SHOW Name | Remarks |
COLLATION_NAME | Collation | |
CHARACTER_SET_NAME | Charset |