MySQL database could not be inserted in Chinese what's going on?

Source: Internet
Author: User

Insert Chinese On Error:

Incorrect?string?value:? ' \xe7\x8f\xbd\xe7\x8f\xba '? For?column? ' Name '? at?row?1

With set names UTF8 or gb2312 can sometimes be inserted, but it is garbled, what is going on?

"Workaround"

This is because the encoding is not selected when the database is created, and the database is recreated with UTF8 encoding.

The encoding format is then set first when the query is executed.

SET names ' UTF8 ';

INSERT into Test1 (name) VALUES (' Chinese ')

?

If you want to see the format supported by the current database, run the following command:

Show variables like ' char% ';

?

MySQL database could not be inserted in Chinese what's going on?

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.