When inserting Chinese characters into Mysql? No.

Source: Internet
Author: User
Tags mysql commands
When inserting Chinese characters into Mysql, what is displayed? First of all, the reason is that the consistent answer on the internet is that the character set does not match each other. You only need to change the character set in the same way. I spent two afternoons to get the modification steps. 1. Set the connection statement in the program: Stringurljdbc: mysql: 127.0.0.1: 3306 drink

When inserting Chinese characters into Mysql, what is displayed? First of all, the reason is that the consistent answer on the internet is that the character set does not match each other. You only need to change the character set in the same way. I spent two afternoons to get the modification steps. 1. Set the connection statement in the program: String url = "jdbc: mysql: // 127.0.0.1: 3306/drink

When inserting Chinese characters into Mysql, what is displayed? No.

The reason is that the consistent answer on the internet is that the character set is not compatible.

The reason is simple. You only need to change the character set in the same way.

I spent two afternoons to get the modification steps.

First, set the connection statement in the program: String url = "jdbc: mysql: // 127.0.0.1: 3306/drink_manage? UseUnicode = true & characterEncoding = UTF8 ";

Second, the character set of the database is utf8, and the character set of each table is also utf8.

Third: In c: // program files/mysql/my, when ini opens this configuration file, the default-character-set? To utf8 to save the file.

4. Open the mysql client. Enter show variables like 'Char % '; to check the character set settings.

Besides character_set_server? The value of character_set_database is latin, and the value of character_set_filesystem is binary. All other values are utf8. My problem is solved here. As for how to set the server and database character sets, I did not go deep into it. If I know anything, I can tell you.

The following are several mysql commands:

(1): show? Variables? Like? 'Char % ';

(2): \ s;

(3): set? Character_set_server = utf8; // This character set modification method cannot be saved after mysql is restarted.

The above are some experiences, which may not be suitable for all people. But if you want to change it, you can definitely change it.

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.