How to solve the Chinese problem of MySQL database:
1. my. ini MySQL Configuration File Settings
[Client]
Default-character-set = gbk
[Mysqld]
Default-character-set = gbk
2. Start the MySQL service to create your database
3. Verify the current Encoding
Command Line input:
Mysql-u root-p
Log on to your database
> Connect yourdatabasename
Enter database STATUS Command
> Status
The result is as follows:
Server characterset: gbk
Db characterset: gbk
Client characterset: gbk
Conn. characterset: gbk
The database character set is set correctly.
3. Then (Note: OPTIONAL), add parameters after the JDBC URL
? AutoReconnect = true & useUnicode = true & characterEncoding = GBK
You can skip this step. The current jdbc driver automatically recognizes the character set of the MySQL database.
If you are using utf8 encoding, you can change default-character-set to utf8, and MySQL uses latin1 by default.