Analysis of database garbled problem

Source: Internet
Author: User

Database garbled problem mainly because the character set is a problem!

1, in the database by viewing the configured character set:

The character sets that the database can set are:

Mysql> show Character 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 | 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 | 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 |

+----------+-----------------------------+---------------------+--------+

$ rows in Set (0.00 sec)

Mysql>

The main commonly used are:

+----------+-----------------------------+---------------------+--------+

| Charset | Description | Default Collation | MaxLen |

+----------+-----------------------------+---------------------+--------+

| Latin1 | cp1252 West European |      Latin1_swedish_ci | 1 | MySQL Default character set

| gb2312 | GB2312 Simplified Chinese |      Gb2312_chinese_ci | 2 | System default Character Set

| UTF8 | UTF-8 Unicode |      Utf8_general_ci | 3 | Use in mixed Chinese and English

| GBK | GBK Simplified Chinese |      Gbk_chinese_ci | 2 | Large number of Chinese character sets

+----------+-----------------------------+---------------------+--------+

To view the character set currently used by the database:

Mysql> Show variables like ' character% ';

+--------------------------+----------------------------+

| variable_name | Value |

+--------------------------+----------------------------+

| character_set_client | UTF8 | #客户端字符集

| character_set_connection | UTF8 | #连接字符集

| Character_set_database | UTF8 | #数据库字符集, configuration file development or database table designation

| Character_set_filesystem | binary |

| Character_set_results | UTF8 | Returns the result character set

| Character_set_server | UTF8 | Server character set, configuration file designation, or build library table designation

| Character_set_system | UTF8 |

| Character_sets_dir | /usr/share/mysql/charsets/|

+--------------------------+----------------------------+

8 rows in Set (0.00 sec)

Mysql>



This article is from the "mysql_db" blog, make sure to keep this source http://mysqldb.blog.51cto.com/10264653/1658342

Analysis of database garbled problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.