MySQL solves SQL garbled characters in the Mac console _ MySQL

Source: Internet
Author: User
MySQL solves bitsCN.com with SQL garbled characters in the Mac console

Solve SQL garbled characters in the Mac console

1. scenario: the mysql database is on the slave machine, the slave machine is on the LAN, the ssh host is required, and then the ssh slave machine (the slave machine) is on the client machine) similar to the following architecture

As a result, I cannot directly connect to the tool, so I have to SSH, then mysql-u root-p, insert update,

However, garbled characters occur during operations such as insert select.

The first thought was that variables was not properly set. show, indeed.

Set character_set_client = 'utf8' to utf8. Note that it is not utf-8. character_set_filesystem is not required. The file itself is binary.

Then perform the data operation.

Note:

Mysql5 provides the following system variables for setting character sets:

Character_set_client client character set

Character_set_connection character set used for client-to-server connection

Character_set_results SELECT character set of the returned data

Character_set_database character set used by the database

Garbled characters are generally caused by incorrect settings of the preceding variables,

Note: character_set_client and character_set_connection must be consistent with character_set_database encoding,

Character_set_results ensures that the returned results are encoded with the program.

We can use set names in the program to set the three system variables character_set_client, character_set_connection, and character_set_results at the same time.

BitsCN.com

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.