Use UTF8 encoding all
MySQL Chinese garbled solution
- To view the default encoding format:
Mysql> Show variables like "%char%";
- To set the encoding format:
SET character_set_client= ' UTF8 '; SET character_set_connection= ' UTF8 '; SET character_set_server= ' UTF8 ';
- To view the encoding format of the database test:
- To set the encoding format for database test:
ALTER DATABASE ' test ' DEFAULT CHARACTER SET UTF8 COLLATE utf8_general_ci;
- To view the encoding format for the data table testtable:
Mysql> Show CREATE TABLE testtable;
- To set the encoding format for the data table testtable:
ALTER TABLE ' testtable ' DEFAULT CHARACTER SET UTF8 COLLATE utf8_general_ci;
- Specify UTF8 encoding when creating databases and data tables:
Create database ' Test ' CHARACTER SET ' UTF8 ' COLLATE ' utf8_general_ci ';
Build data table CREATE TABLE ' Database_user ' ( ' ID ' varchar (+) NOT null default ' ', ' UserID ' varchar (+) NOT null default ' ', ) Engine=innodb DEFAULT Charset=utf8;
After the setup is complete, the query Chinese display is normal
Navicat for MySQL Chinese garbled
- modifying Navicat server connection properties and database properties
Reconnect still garbled
- Modify the MySQL installation directory under the My.ini file
Reconnect still garbled
- Navicat connection encoding format to "current Windows Codepage"
Reconnect, show normal
MySQL and navicat for MySQL Chinese garbled