Solve the Problem of MySQL Chinese garbled characters

Source: Internet
Author: User

First, set the default Latin1 to GBK when installing MySQL. If you do not select this option, go to the installation directory and find the my. ini configuration file, which contains two lines of characters, and change them to GBK. For example, default-character-set = GBKSecond, if you have created a previously created table, you need to change the character set of each table to GBK.

Create Table 'city' (
'pid 'int (10) Not null,
'city' varchar (200) not null,
'id' int (10) Not null auto_increment,
Primary Key ('id')
) engine = InnoDB default charset = GBK
note that the last sentence is very important. again, it is best to write a filter when calling at the front end. In this way, garbled characters will disappear.

ImportantNote: After the database is modified, you must restart the database to take effect.

Open cmd to enter DoS:

Disable net stop MySQL

Enable Net start MySQL

This method applies to mysql5.x

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.