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 this because MySQL Default
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 this because MySQL Default
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, the default Character Set of MySQL is latin1 (ISO_8859_1) and not utf8.
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 _ % ';
Related reading:
Ubuntu 12.04 MySQL cannot be started after UTF-8 is changed
Using mysqldump in Linux to back up a MySQL database as an SQL File
Use mysqldump in Linux to regularly back up MySQL Databases