| |

VerySource

 Forgot password?
 Register
Search
View: 30|Reply: 1

About Chinese encoding in the database

[Copy link]

1

Threads

1

Posts

2

Credits

Newbie

Rank: 1

Credits
2

 China

Post time: 2020-2-2 12:00:02
| Show all posts |Read mode
There is a problem that I have not understood. I use JDBC to write a record to mysql. I write Chinese directly in Java programs. But what I see in mysql is garbled.

What's going on with this question?

Thank you all!
Reply

Use magic Report

0

Threads

16

Posts

13

Credits

Newbie

Rank: 1

Credits
13

 China

Post time: 2020-4-3 23:00:02
| Show all posts
Modifying mysql's default character set is achieved by modifying its configuration file. There are two general situations:
[edit]
Windows platform

The mysql configuration file under windows is my.ini, generally in c:\windows\my.ini or c:\winnt\my.ini can be directly added in this file

default-character-set = gbk #or gb2312, big5, utf8

Then restart mysql

service mysql restart

or

/etc/init.d/mysql restart

Or restart by other methods, it will take effect.
[edit]
Unix platform

The mysql configuration file under Linux is my.cnf, usually /etc/my.cnf. If you can't find it, you can find it with the find command:

find / -iname my.cnf

Add in this file

default-character-set = gbk #or gb2312, big5, utf8

Then restart mysql

net stop mysql
net start mysql

It took effect.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2020|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list