MySQL Character set: A way to ensure that no garbled characters occur

Source: Internet
Author: User
Tags character set ini

There are many types of character sets in the database, and the main influence on programming is the client character set and database character set (there is also a server character set, do not know what to do).

The common operation in the database is to save the data and read the data, in this process, chaos and the database character set does not seem to have any relationship. We only need to ensure that the character set that is selected at write time is consistent with the character set chosen when reading, that is, only the client character set of two operations can be guaranteed.

Settings for the client character set, depending on the client's different methods:

1. Use the console connection, set in the client item in the My.ini file;

2. Use EMS connection, priority to use the character set of EMS connection configuration, use the setting in My.ini file by default;

3.JDBC connection, specified in the connection string:

Jdbc:mysql://192.168.3.99:3306/test?useunicode=true&;characterencoding=gbk

When written, MYSQ converts the character set specified by the client to the database character set, which is displayed to the client by converting the database character set to the client-specified character set, and the client character set and database characters are set consistently, and the obvious benefit is to avoid the performance loss of the conversion; Setting the database character set to the character set supported by most databases is a big hassle if you take into account the migration of the database later.

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.