MySQL base character set and garbled

Source: Internet
Author: User

Original: MySQL base character set and garbled

Mysql 's character set is very flexible

You can set the server default character set

Database default Character Set

Table Default Character Set

Column Character Set

If a certain level does not specify a character set , the upper level is inherited .

For example , declare UTF8 as a table:

The stored data is in the table , and finally the UTF8;


1: tell the server , What is the data I sent you encoded ? character_set_client

2: tell the converter what code to convert to ? Character_set_connection

3: What code is the result of the query ? Character_set_results

If all of the above 3 are character set N, you can shorthand for set names n

Inference : What will be garbled ?

1:client statement is inconsistent with the facts

2:results When the client page does not match .

What time will the data be lost ?

Connetion and the server's character set are more than client hours .

Proofing set : refers to the collation of a character set

A character set can have one or more collations .

Take Utf8 as an example , We default to make the utf8_general_ci rule , You can also sort by binary , Utf8_bin

How do I declare a proofing set ?

Create table () ... Charset UTF8 collate utf8_general_ci;

Note : The declared proofing set must be a valid collation set of character sets .


MySQL base character set and garbled

Related Article

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.