When you use the mysql database to insert data, the question mark (?) appears (?) Problem, solution, mysql question mark

Source: Internet
Author: User

When you use the mysql database to insert data, the question mark (?) appears (?) Problem, solution, mysql question mark

First, the mysql database I use is 5.7.12.

Problems:

1. Data insertion error. insertion failed. The following error occurs: Incorrect string value: '\ xCD \ xF5 \ xD5 \ xBC \ xBE \ xa9' for column 'sname' at row 1.

2. Chinese characters are inserted. Although the insertion is successful, the result is displayed as follows :??

Solution:

Add # character-set-server = utf8 to [mysqld] In the my. ini file

The content in the blue circle must be at the top of the blue circle, that is, the content in the blue circle must be at the bottom of [mysqld]; otherwise, the database cannot be logged on.

If the above solution still cannot be solved? Problems,

When connecting to the database, add? UseUnicode = true & characterEncoding = UTF-8. As follows:

"Jdbc: mysql: // localhost: 3306/sgmanagement? UseUnicode = true & characterEncoding = UTF-8 ";

Also on the Internet: Add # default-character-set = utf8 under [mysqld], but I didn't use it.

Feelings:

Now, of course, I am in a good mood. I spent 3 or 4 hours searching the Internet to find a lot of solutions, which is useless. Huang Tianyan did not suffer, and finally to try out.

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.