Operating MySQL database in DOS garbled in Chinese

Source: Internet
Author: User
Tags mysql insert

1. Problem: The recent use of MySQL database operation, in DOS use command line to the MySQL insert/read Chinese when garbled problem.

2. Reason: Because the cmd client default encoding is GBK, and I install MySQL when the encoding is UTF-8; If you want to change the character encoding of the CMD client, this is not a good line.

3. WORKAROUND: Ensure that the CMD client and MySQL are encoded in the same code.

Operation Steps:

1) Use Windows+r shortcut key, input cmd;

2) Enter Mysql-uroot-p, then enter the password into the database operation;

3) Set the database encoding:

Setcharacter_set_client=gbk;

Setcharacter_set_results=gbk;

4. Note:

1) Set the code in DOS only applicable to the current operation, after exiting the login still garbled;

2) need to be set in MySQL configuration file (My.ini or My-default.ini);

3) If the file cannot be found, please refer to my blog everything tool use Find.

Operating MySQL database in DOS garbled in Chinese

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.