Command for viewing the mysql character set.
Including viewing the character set of the mysql database server, viewing the character set of the mysql database, the character set of the data table and field, and the character set supported by the currently installed mysql.
1. view the mysql database server and database character set.
- Mysql> show variables like '% char % ';
- + -------------------------- + ------------------------------------- + ------
- | Variable_name | value | ......
- + -------------------------- + ------------------------------------- + ------
- | Character_set_client | utf8 |... -- client Character Set
- | Character_set_connection | utf8 | ......
- | Character_set_database | utf8 | ...... -- database Character Set
- | Character_set_filesystem | binary | ......
- | Character_set_results | utf8 |... www.jbxue.com
- | Character_set_server | utf8 | ...... -- server Character Set
- | Character_set_system | utf8 | ......
- | Character_sets_dir | d: \ mysql server 5.0 \ share \ charsets \ | ......
- + -------------------------- + ------------------------------------- + ------
2. view the character set of the mysql DATA table.
- Mysql> show table status from sqlstudy_db like '% countries % ';
- + ----------- + -------- + --------- + ------------ + ------ + ----------------- + ------
- | Name | engine | version | row_format | rows | collation | ......
- + ----------- + -------- + --------- + ------------ + ------ + ----------------- + ------
- | Countries | innodb | 10 | compact | 11 | utf8_general_ci | ......
- + ----------- + -------- + --------- + ------------ + ------ + ----------------- + ------
3. view the character set of the mysql DATA column.
- Mysql> show full columns from countries;
- + ---------------------- + ------------- + ----------------- + --------
- | Field | type | collation | .......
- + ---------------------- + ------------- + ----------------- + --------
- | Countries_id | int (11) | null | .......
- | Countries_name | varchar (64) | utf8_general_ci | .......
- | Countries_iso_code_2 | char (2) | utf8_general_ci | .......
- | Countries_iso_code_3 | char (3) | utf8_general_ci | .......
- | Address_format_id | int (11) | null | .......
- + ---------------------- + ------------- + ----------------- + --------
- Mysql Character Set viewing and setting
- Mysql Character Set settings
- Summary of mysql Character Set settings
- Mysql Character Set setting
4. view the character sets supported by currently installed mysql.
- Mysql> show charset;
- Mysql> show char set;
- + ---------- + ----------------------------- + --------------------- + -------- +
- | Charset | description | default collation | maxlen |
- + ---------- + ----------------------------- + --------------------- + -------- +
- | Big5 | big5 traditional chinese | big5_chinese_ci | 2 |
- | Dec8 | dec west european | dec8_swedish_ci | 1 |
- | Cp850 | dos west european | cp850_general_ci | 1 |
- | Hp8 | hp west european | hp8_english_ci | 1 |
- | Koi8r | koi8-r relcom russian | koi8r_general_ci | 1 |
- | Latin1 | cp1252 west european | latin1_swedish_ci | 1 |
- | Latin2 | iso 8859-2 central european | latin2_general_ci | 1 |
- | Swe7 | 7bit swedish | swe7_swedish_ci | 1 |
- | Ascii | us ascii | ascii_general_ci | 1 |
- | Ujis | euc-jp japanese | ujis_japanese_ci | 3 |
- | Sjis | shift-jis japanese | sjis_japanese_ci | 2 |
- | Hebrew | iso 8859-8 hebrew | hebrew_general_ci | 1 |
- | Tis620 | tis620 thai | tis620_thai_ci | 1 |
- | Euckr | euc-kr korean | euckr_korean_ci | 2 |
- | Koi8u | koi8-u ukrainian | koi8u_general_ci | 1 |
- | Gb2312 | gb2312 simplified chinese | gb2312_chinese_ci | 2 |
- | Greek | iso 8859-7 greek | greek_general_ci | 1 |
- | Cp1250 | windows central european | cp1250_general_ci | 1 |
- | Gbk simplified chinese | gbk_chinese_ci | 2 |
- | Latin5 | iso 8859-9 turkish | latin5_turkish_ci | 1 |
- | Armscii8 | armscii-8 armenian | armscii8_general_ci | 1 |
- | Utf8 | UTF-8 unicode | utf8_general_ci | 3 |
- | Ucs2 | ucs-2 unicode | ucs2_general_ci | 2 |
- | Cp866 | dos russian | cp866_general_ci | 1 |
- | Keybcs2 | dos kamenicky czech-slovak | keybcs2_general_ci | 1 |
- | Macce | mac central european | macce_general_ci | 1 |
- | Macroman | mac west european | macroman_general_ci | 1 |
- | Cp852 | dos central european | cp852_general_ci | 1 |
- | Latin7 | iso 8859-13 baltic | latin7_general_ci | 1 |
- | Cp1251 | windows cyrillic | cp1251_general_ci | 1 |
- | Cp1256 | windows arabic | cp1256_general_ci | 1 |
- | Cp1257 | windows baltic | cp1257_general_ci | 1 |
- | Binary pseudo charset | binary | 1 |
- | Geostd8 | geostd8 georgian | geostd8_general_ci | 1 |
- | Cp932 | sjis for windows japanese | cp932_japanese_ci | 2 |
- | Eucjpms | ujis for windows japanese | eucjpms_japanese_ci | 3 |
- + ---------- + ----------------------------- + --------------------- + -------- +
The preceding mysql character set command is applicable to windows and linux.