MySQL setting character set

Source: Internet
Author: User

In general, to prevent the program from garbled in the process of interaction, so the front and back of the platform will agree to the encoding format.

Because UTF-8 encoding is international, I set the encoding format UTF-8 in MySQL.

Check the MySQL encoding format first.

Show variables like ' character\_set\_% ';

Found a variety of different.

Ok! Now start the configuration:

Task Manager, stop the MySQL service.

Locate the My.ini file in the MySQL installation directory, create a new My.ini file, and copy the My-default.ini file contents to the My.ini file.

1. In profile My.ini [client] Add Default-character-set =utf8, the newly created connection on this computer will take effect immediately
2. Add Default-character-set =utf8 in Profile My.ini [mysqld], take effect after mysqld service restart
Turn on MySQL service.
3. Execute the SET statement to modify the character set, and the newly created connection to the non-native will also take effect
SET GLOBAL Character_set_client=utf8;
SET GLOBAL Character_set_connection=utf8;
SET GLOBAL Character_set_database=utf8;
SET GLOBAL Character_set_results=utf8;
SET GLOBAL Character_set_server=utf8;

Quit MySQL. Log in again. Inquire

Show variables like ' character\_set\_% ';

The encoded characters have now been corrected.

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.