Mysql utf8 in windows Command Line garbled Solution

Source: Internet
Author: User

Mysql utf8 garbled characters in the windows command line. If you want to set the database encoding to utf8, you must first set my In the mysql installation path. the default-character-set attribute in the INI file is set to utf8, that is, default-character-set = utf8, and then enter the command show variable like 'Char % '; command to check whether all character sets have been changed to utf8. If yes, you have set them successfully. After setting it to utf8, if you use the management tool to operate mysql, you will find that the Chinese field value is correct, but if you use the command line to query it, garbled characters will occur. When you insert the Chinese field value, the error message "Incorrect string value: '\ xD6 \ xD0 \ xCE \ xC4' for column" is also displayed. This may be related to the problem that the hosts page of windows command line is encoded as gbk, enter the command set names gbk before performing the query or update operation; this command can set the encoding with three configurations to gbk so that you can perform normal Chinese operations. After the operation is complete, you can enter set names utf8. The encoding is reset.

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.