Solution to garbled characters in JAVA Development under Ubuntu + MySQL

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.