First of all, this is the default MySQL character set () In Ubuntu. It is garbled question mark when entering Chinese Characters in Java to the database. MySQL does not recognize it because the default Character Set of MySQL is latin1 (ISO_8859_1) it is not a UTF-8 character set. Modification Method: 1. open my. modify the cnf file (note that the MySQL version is later than 5.5, and the following versions should also be common. This is not tested, but it is absolutely feasible to use the cnf File above 5.5) sudogedit
First of all, this is the default MySQL character set () In Ubuntu. It is garbled question mark when entering Chinese Characters in Java to the database. MySQL does not recognize it because the default Character Set of MySQL is latin1 (ISO_8859_1) it is not a UTF-8 character set.
Modification method:
1. Open the my. cnf file and modify it. (Note that the MySQL version is later than MySQL 5.5 and the following versions are also common. The MySQL version has not been tested, but is absolutely feasible in MySQL 5.5 or later versions)
Sudo gedit/etc/mysql/my. cnf
2. add the following code under [mysqld] (for Versions later than 5.5, the default Character Set setting of [mysqld] is an abandoned parameter, which can be used. For details, refer to the corresponding version manual)
Character-set-server = utf8
Collation-server = utf8_general_ci
Skip-character-set-client-handshake
3. Exit and restart the mysql service.
Sudo service mysql restart
4. Go to mysql to view the character set
Mysql> show variables like 'collation _ % ';
Mysql> show variables like 'character _ set _ % ';
Reading:
Ubuntu 12.04 MySQL UTF-8 cannot start the http://www.linuxidc.com/Linux/2012-06/63362.htm
Linux Through mysqldump backup MySQL database into SQL file http://www.linuxidc.com/Linux/2013-02/79793.htm
Using mysqldump in Linux to regularly back up MySQL database http://www.linuxidc.com/Linux/2012-03/56063.htm
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2