Linux modified MySQL database character encoding for UTF-8 solve Chinese garbled

Source: Internet
Author: User

The database is garbled because of the MySQL encoding cause.

Workaround:

Modifying the MySQL database character encoding for Utf-8,utf-8 contains the characters that are required for all countries worldwide and is an international code.

Specific operation:

1 , go to MySQL console

>mysql-uroot-p     # Enter password into >status;             # View the current MySQL run status as shown in:

2 , modifying the MySQL configuration file

[[Email protected] ~] # vi/etc/my.cnf # Add the following code to the [client] segment default-character-set=UTF8# adds the following code to the [MySQL] segment character-set-server=UTF8  # Add the following code to the [mysqld] segment Character-set-server=utf8

3 , restart the MySQL service

[[Email protected] ~] # Service mysqld Restart # check back into the MySQL console as shown in:>status;

>show variables like ' character_set_% ';            # view MySQL Character set

MySQL database character set encoding modification complete!

Parameter description:

Character_set_client: The character set of the client request data.

Character_set_connection: A character set that receives data from the client and then transmits it.

Character_set_database: The character set of the default database, regardless of how the default database is changed, is this character set, and if there is no default database, this parameter does not need to be set character_set_server the specified character set.

Character_set_filesystem: The operating system on the file name into this character set, that is, the character_set_client conversion character_set_filesystem, the default binary can be.

Character_set_results: The character set of the result set.

Character_set_server: The default character set for the database server.

Character_set_system: This value is always utf8 and does not need to be set to store the system metadata for the character set.

Linux modified MySQL database character encoding for UTF-8 solve Chinese 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.