Environment: Ubuntu
MYSQL 5.0.38
JDK 1.6
Ecplise 3.2.2
Hibernate 3.2
Mysql query browser 1.2.5bate
During java project development, it was found that the Insert data was garbled and no solution was found for searching various cool people. Try the combinations of various modifications and finally solve the problem.
1. Modify the mysql configuration file sudo gedit/etc/mysql/my. cnf
Add default-character = utf8
2. Create a database under mysql shell.
Create database pencat default character set utf8;
3. Create a table.
Create table 'pencat'. 'user '(
'User _ id' int (11) not null auto_increment,
'Name' varchar (160) not null,
'Sex 'char (1) default NULL,
'Age' int (11) default NULL,
Primary key ('user _ id ')
) ENGINE = MyISAM AUTO_INCREMENT = 4 default charset = utf8;
Now, all the problems are solved. Insert, read, and manage in the GUI in Chinese.