MySQL cannot insert Chinese Characters

Source: Internet
Author: User

 

I have been using Oracle in my company. At home, the machine configuration is too bad, so I plan to use MySQL.

Installation, database creation, and table creation are all good. However, when data is inserted, the English language is correct.

Data Too long for column 'sname' at Row 1I checked the cause on the Internet. It turned out to be a character set problem. The modification method is as follows: (1) modify my. ini (MySQL server instance configuration file) under the MySQL installation directory ). Set default-character-set = GBK (Note: there are 2 places)
(2) modify the database under the corresponding database directory in the data directory. opt configuration file default-character-set = GBK default-collation = gbk_chinese_ci restart the database, close the console window and log on to the database again, execute SQL, everything is normal, and use JSP to connect again, no garbled characters. OK!

 

Related Article

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.