MySQL4.1.7 's character Set problem

Source: Internet
Author: User
mysql| problem
Copyright NOTICE: If there is a reprint request, please specify the source: Http://blog.csdn.net/yzhz

Environment: 1, MySQL database version: MySQL4.1.72, MySQL driver: mysql-connector-java-3.1.73, Environment: Windows platform 4, the installation of MySQL database specified character-set as GBK

Problems encountered: The use of JDBC access to the database, JDBC Url:jdbc:mysql://localhost:3306/club, read-write database display Chinese are normal.      But in the MySQL console query, the Chinese are shown as?   The reason is: MySQL more than 4.1 version of the addition of several variables, the default case character_set_client, Character_set_connection, character_set_results value is latin1 character_set_client | latin1character_set_connection | Latin1character_set_database | Gbkcharacter_set_results | Latin1character_set_server | Gbkcharacter_set_system |   UTF8 so in the console see the Chinese record as? The workaround is to set the Default-character-set Mysql-uuser-ppassword--DEFAULT-CHARACTER-SET=GBK test When the console is started

character_set_client | gbkcharacter_set_connection | Gbkcharacter_set_database | Gbkcharacter_set_results | Gbkcharacter_set_server | Gbkcharacter_set_system | Utf8

Summary: 1, MySQL4.1 above version, MySQL jdbc Driver3.0.16 above version, the JDBC URL does not need to bring the USEUNICODE=TRUE&ENCODINGCHARACTER=GBK, The JDBC driver automatically detects the encoding specified by the MySQL server's variable (character_set_server) at the time of the connection, and then converts the Java Unicode string to the specified character set to the MySQL server.2, MySQL4.1.7 version of the database, Character-set for GBK, if the console see garbled, start the console with parameters--DEFAULT-CHARACTER-SET=GBK


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.