MySQL database, when the table has Chinese, select out a lot of question mark (?) solution

Source: Internet
Author: User

In QQ Group asked some master, at the same time reference this article: http://huangyunbin.iteye.com/blog/1113983, finally put this problem to fix.

First of all, I use the zip packet of MySQL, the direct decompression used, the online said to modify My.ini or my.cnf on my machine is not found at all. But My.ini this thing can be added by itself. Copy the My-default.ini file in the MySQL directory (the original template or leave a copy) and rename it to My.ini. Open the My.ini and add the following two lines at the end:

[mysql] default - character - Set =UTF8

Save. Also check that there are two lines in the Db.opt file in the./data/performance_schema directory:

default - character - Set = UTF8 default -ollation=utf8_chinese_ci

It is then set up in the database. Enter in MySQL

1 mysql>like'char%';

You can see that the character set in my database is in the sauce:

According to most of the suggestions of netizens, in addition to filesystem that binary does not move, all other changes into UTF8 good.

1Mysql>SetCharacter_set_client= 'UTF8';2Mysql>SetCharacter_set_connection= 'UTF8';3Mysql>SetCharacter_set_database= 'UTF8';4Mysql>SetCharacter_set_results= 'UTF8';5Mysql>SetCharacter_set_server='UTF8';

Ok. You can execute show variables like ' char% ' again, and see the results of the changes. Now the character set is UTF-8.

In the final step, to modify the previously garbled table, the character encoding is also modified to UTF-8:

1 MYSQL>altertablecharacterset UTF8;

This is done. Then select the previous table, Chinese is not all changed over?

==================== Advertising Time ====================

Finally recommend my group: Fish fragrant shredded pork. Group number: 234509621. Here are product managers, testers, code Daniel, have determined to engage in the IT industry is reading the future star, there are various technical information. Welcome it patients to join. However, dabigatran there are restrictions, please specify the reasons for the group, otherwise the administrator will not give through (generally write an IT ah, computer ah, algorithm ah, or do what work, almost can). After entering the group to say hello to everyone, and then to the group file to download the group rules to see. After that, we can play happily with everyone.

MySQL database, when the table has Chinese, select out a lot of question mark (?) solution

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.