MySQL4.1.7 Character Set Problems

Source: Internet
Author: User

This article mainly introduces the problems related to the character set of MySQL4.1.7, as well as the actual environment and the list of problems encountered in actual operations and the description of the actual solution, the following is a detailed description of the article. I hope you will gain some benefits after browsing it.

Environment:

1. MySQL (the best combination with PHP) database version: MySQL (the best combination with PHP) 4.1.7

2. MySQL (the best combination with PHP) DRIVER: MySQL (the best combination with PHP)-connector-java-3.1.7

3. Environment: windows Platform

4. set character-set to gbk when installing the MySQL database (the best combination with PHP)

Problem: Use jdbc to access the database. The jdbc url: jdbc: MySQL (the best combination with PHP): // localhost: 3306/club. Reading and writing the data in the database display is normal.

However, in the console of MySQL (the best combination of PHP and MySQL), the query is displayed ?. The reason is: MySQL (the best combination with PHP) 4.1 and later versions added several variables, by default, the value of character_set_client, character_set_connection, and character_set_results is latin1 character_set_client | character | utf8. The Chinese record displayed on the console is?

Solution: set default-character-set MySQL (the best combination with PHP) when you start the console-uuser-ppassword -- default-character-set = gbk test

Character_set_client | gbkcharacter_set_connection | gbkcharacter_set_database | gbkcharacter_set_results | gbkcharacter_set_server | gbkcharacter_set_system | utf8

Summary:

1. MySQL (the best combination with PHP) Version 4.1 or later, MySQL (the best combination with PHP) JDBC Driver3.0.16 or later, the jdbc url does not need to be followed by useUnicode = true & EncodingCharacter = GBK. The jdbc driver will automatically detect the variable character_set_server of the MySQL (best combination with PHP) server during connection) the specified encoding, and then convert the Java Unicode string to the specified character set and send it to MySQL (the best combination with PHP) server.

2. MySQL (the best combination with PHP) 4.1.7 database, character-set is gbk. If garbled characters are displayed on the console, when you start the console, take the parameter -- default-character-set = gbk

The above content is an introduction to the Character Set Problem of MySQL4.1.7. I hope you will get something.

The above content describes the problem of the character set of MySQL4.1.7. I hope it will help you in this regard.

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.