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