I. Causes
MyEclipse inserted in Chinese found not only in MySQL and in the MyEclipse query are displayed???
? Two. Resolve ?
Online read a lot of information, if in MySQL directly modify, restart MySQL after the failure, general modification My.ini file, of course, under Ubuntu is my.cnf. The process of modification can be referred to http://blog.knowsky.com/190431.htm
But in the course of my modifications, I found:
Find [mysqld] below to join
Default-character-set=utf8
init_connect= ' SET NAMES UTF8 '
Once the Mysqlid is modified, it will be error to start MySQL again: Error 2002 (HY000): Can ' t connect to local MySQL server through socket '/var/run/mysqld /mysqld.sock '
Find a lot of methods, are not very effective, I instead in a modification my.cnf accidentally deleted all the files, have to reinstall MySQL
By the way, introduce how and reload MySQL
Three. mysql Reload
See http://www.jbxue.com/db/14719.html for more details
? Four. Continue to solve garbled problems ?
Installation complete, view current encoding settings
|character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | latin1 | | character_set_system | utf8
Found
Character_set_server
Or latin1 reason to find, the following to solve, the original reason for this ~
The others are the same as above, only added under [Mysqld]
Default-character-set=utf8
Switch
Character-set-server=utf8
Try to modify
Enter command sudo service mysql restart
to restart MySQL and start successfully! Then look at the code:
+--------------------------+----------------------------+ | variable_name | Value | +------------------ --------+----------------------------+ | 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 |
Run JUnit test again, insert Chinese success!!!
Ubuntu under the fix MySQL insert Chinese garbled (???? ) problems