MySQL Character set garbled

Source: Internet
Author: User

Learning database, the most frustrating is the character set of the problem, once a problem, there will be the impulse to smash the computer, especially after modifying a lot of character sets are still unsuccessful!

The database software I use is MySQL 5.1.28. When the problem started, it was this:

Scenario One: Each time the input (insert) command, always error, said a row of a row of errors, and then, I deleted the line, and then try, but, still error, but, the hint of the mistake is another line, until I will be the statement containing Chinese characters in the command of all deleted after the perfect pass, yes, is passed;

Scenario Two: Can be inserted in Chinese characters, no error, no warnings, each time with select Choose Table Content Display, no error, no warnings, but, read out the Chinese characters have become a question mark '? ';

It was only after I found the problem that I began to modify the character set with the alter that the teacher taught, but it didn't work. So I turned over the book and found a way to solve the problem.

First, you enter in the command line

Show variables like ' char% ';

This clause is used to query the current character set encoding. If you find out what's happening here,

Character_set_database:latin1character_set_results:latin1character_set_system:Latin1character_set_server: Latin1

So, next you'll enter the following command on the command line

Character_set_database: ' GBK ' character_set_server: ' GBK ' character_set_results: ' GBK ' character_set_system: ' UTF8 '

You can also change the GBK to UTF8, at which point the problem should have been resolved.

Just, maybe after reboot, the character set will not be restored, this is an unknown, anyway my is not ^_^

MySQL Character set garbled

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.