MySQL cannot insert Chinese characters.

Source: Internet
Author: User

Switch from csdn -- http://topic.csdn.net/u/20070418/16/b7ad36d1-d011-45a4-b4e5-d796d65feedd.html

 

MySQL sets the encoding method

MySQL can insert English fields into the database. When I enter Chinese characters, the field data truncation: data too long for column 'name' at Row 1 appears.
My friend's method is as follows:

(1) Modify c: \ developer \ mysql5.0 \ My. ini (MySQL server instance configuration file)
Set default-character-set = GBK (Note: there are 2 places)
(2) modify the DB. Opt configuration file under the corresponding database directory in the Data Directory
Default-character-set = GBK
Default-collation = gbk_chinese_ci
Restart MySQL.
But the problem persists!
Is there any other way for friends?
Of course, if my name varchar (40) can contain 20 Chinese characters, I only need to query 2 Characters!

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.