The summary of the problem-solving method of Chinese garbled under Mysql _mysql

Source: Internet
Author: User

Solve the problem that the Chinese garbled under MySQL is all question mark

is also a headache of Chinese garbled problem, just start I have been using the local database test, this is no problem ah, not a problem, but I forget the Android and the Web is the server on my database, measured a bit, really garbled.

Try a lot of methods on the Internet, although do not know exactly which method to set up, you have to say it

The first of these methods

Just start checking the MySQL database, found that, as the web said, part of the code is Latin1, is the following:

Change decisively.

Set Character_set_client=utf8;
Set Character_set_connection=utf8;
Set Character_set_database=utf8;
Set Character_set_results=utf8;
Set Character_set_server=utf8;
Set Character_set_system=utf8;

After the change is finally utf8, but measured, or not ...

The second method

Because I used the Tencent cloud server, the system is Linux server, so only to say that the modified Linux method

Modify/ETC/MYSQL/MY.CNF This file, add the following code in the corresponding place OK

[Client]
Port = 3306
socket =/var/lib/mysql/mysql.sock
Default-character-set=utf8

[mysqld]
port = 3306
Socket =/var/lib/mysql/mysql.sock
Character-set-server=utf8

[MySQL]
no-auto-rehash

After restarting the database, it solves the garbled problem perfectly.

Thank you for reading, I hope to help you, thank you for your support for this site!

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.