Chinese problem with mysql 4.1

xiaoxiao2021-03-06  18

4.0 Before you use the default character set Latin1, connect usunicode = true & characterencoding = GBK can,

Later, because of the needs of some subqueries, upgrade to 4.1, found this loss, after a day, finally got it: D

1

The mysql character set is set to UTF8, can be set at installation, or change in my.ini (you need to restart MySQL)

#

Must be in [mysqld]

[mysqld] default-character-set = UTF8

This is enough, restarting Server after setting, check with mysqladmin variables command

| Character_set_client | utf8 | character_set_connection | utf8 | character_set_database | utf8 | character_set_results | utf8 | character_set_server | utf8 | character_set_system | utf8 | collation_connection | utf8_general_ci | collation_database | utf8_general_ci | collation_server | utf8_general_ci 2

, JDBC connection does not need to add Characterencoding, it will automatically detect

JDBC: mysql: // localhost / test

In fact, the Server end character set is not UTF8, add it, it is useless (JDBC: mysql: // localhost / test & characterencoding = UTF-8 or GBK)

Maybe it will also be reported; if it is UTF8, add it!

3

, MySQL Client remember to add --default-character-set

Windows

platform:

Mysql -u root -p --default-character-set = GBK Linux

platform:

Mysql -u root -p --default-character-set = UTF8

Otherwise, enter SELECT Chinese is garbled, INSERT Chinese can not save correctly, mainly the whole day is mainly troubled ~~

This is my way, and the MySQL character set is Latin1 or operates in Chinese (4.0 is like this), but I didn't try it, the client still needs additional code.

转载请注明原文地址:https://www.9cbs.com/read-42394.html

New Post(0)