Mysql Chinese garbled solution, mysql garbled Solution
Problem description:Mysql displays garbled characters when inserting Chinese characters "? "No.
Solution:
Modify the my. ini configuration of mysql
[mysql]default_character_set=utf8[mysqld]character_set_server=utf8
// The following content is the test record content, which can be ignored and not read at all. However, to increase the credibility, we have attached the following content :)
Show variables like "% char % ";
Default Value:
+ -------------------------- + --------------------------------------------------- +
| Character_set_client | gbk |
| Character_set_connection | gbk |
| Character_set_database | latin1 |
| Character_set_filesystem | binary |
| Character_set_results | gbk |
| Character_set_server | latin1 |
| Character_set_system | utf8 |
| Character_sets_dir | c: \ wamp \ bin \ mysql \ mysql5.6.17 \ share \ charsets \ |
+ -------------------------- + --------------------------------------------------- +
(This launch is effective, and the cure is permanent)
Set names utf8:
+ -------------------------- + --------------------------------------------------- +
| Character_set_client | utf8 |
| Character_set_connection | utf8 |
| Character_set_database | latin1 |
| Character_set_filesystem | binary |
| Character_set_results | utf8 |
| Character_set_server | latin1 |
| Character_set_system | utf8 |
| Character_sets_dir | c: \ wamp \ bin \ mysql \ mysql5.6.17 \ share \ charsets \ |
+ -------------------------- + --------------------------------------------------- +
(Valid permanently)
My. ini
[Client]
Default_character_set = utf8
+ -------------------------- + --------------------------------------------------- +
| Character_set_client | utf8 |
| Character_set_connection | utf8 |
| Character_set_database | latin1 |
| Character_set_filesystem | binary |
| Character_set_results | utf8 |
| Character_set_server | latin1 |
| Character_set_system | utf8 |
| Character_sets_dir | c: \ wamp \ bin \ mysql \ mysql5.6.17 \ share \ charsets \ |
+ -------------------------- + --------------------------------------------------- +
(Permanently valid, with the same effect as [client] modification)
My. ini
[Mysql]
Default_character_set = utf8
+ -------------------------- + --------------------------------------------------- +
| Character_set_client | utf8 |
| Character_set_connection | utf8 |
| Character_set_database | latin1 |
| Character_set_filesystem | binary |
| Character_set_results | utf8 |
| Character_set_server | latin1 |
| Character_set_system | utf8 |
| Character_sets_dir | c: \ wamp \ bin \ mysql \ mysql5.6.17 \ share \ charsets \ |
+ -------------------------- + --------------------------------------------------- +
(Valid permanently and perfectly displayed in Chinese, avoiding the need to set names utf8 before each data Insert operation)
My. ini
[Mysql]
Default_character_set = utf8
[Mysqld]
Character_set_server = utf8
+ -------------------------- + --------------------------------------------------- +
| Character_set_client | utf8 |
| Character_set_connection | utf8 |
| Character_set_database | utf8 |
| Character_set_filesystem | binary |
| Character_set_results | utf8 |
| Character_set_server | utf8 |
| Character_set_system | utf8 |
| Character_sets_dir | c: \ wamp \ bin \ mysql \ mysql5.6.17 \ share \ charsets \ |
+ -------------------------- + --------------------------------------------------- +