MySQL Chinese garbled solution

Source: Internet
Author: User

I would not suggest richies answer, because is screwing up the data inside the database. You would don't fix your problem but try to "hide" it and not being able to perform essential database operations with the C rapped data.

If you encounter this error either the data "is" sending is not UTF-8 encoded, or your connection was not UTF-8. First, verify, that the data source (a file, ...) really is UTF-8.

Then, check your The database connection, you should do the after connecting:

SET NAMES ‘utf8‘;SET CHARACTER SET utf8;

Next, verify the tables where the data is stored has the UTF8 character set:

SELECT  `Tables`.`table_name`, `Collations`.`Character_set_name`From `Information_schema`.`TABLES` As `Tables`, `Information_schema`.`Collation_character_set_applicability` As  ' collations '   ' tables '. ' table _schema  = database< Span class= "pun" > ()  and  collations "collation_name =  ' tables '. ' table_collation '      

Last, check your database settings:

mysql> show variables like ‘%colla%‘;mysql> show variables like ‘%charac%‘;

If source, transport and destination are UTF-8, your problem is gone;)

Also, after installing MySQL, you should run a command to set the encoding to Utf-8:

Run at the command line first: status to see if the encoding is UTF8.

Set character_set_server = ' UTF8 '; set character_set_connection = ' UTF8 '; set character_set_results = ' UTF8 '; set character _set_client = ' UTF8 '; Change database encoding can be used: ALTER DATABASE db_name default character set ' UTF8 '; Show create table T1; You can view the schema of the table

MySQL Chinese garbled 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.