Navicat Premium introduces the Chinese garbled code solution for SQL import, navicatpremium

Source: Internet
Author: User

Navicat Premium introduces the Chinese garbled code solution for SQL import, navicatpremium

When I asked a friend for a bug today, I was ready to import the data in her database, so I tried to import the corresponding mysql command under the mysql management tool Navicat. The result shows that all the Chinese characters imported are garbled, so the following attempt is made:


In "connection property" Settings, advanced-remove the hook from "use mysql Character Set" and change the encoding to 10008-GB2312.
Then go to the navicat console and run the show variables like 'Char % 'command as follows:
+ -------------------------- + ----------------------------------------- +
| Variable_name | Value |
+ -------------------------- + ----------------------------------------- +
| Character_set_client | latin1 |
| Character_set_connection | latin1 |
| Character_set_database | utf8 |
| Character_set_filesystem | binary |
| Character_set_results | latin1 |
| Character_set_server | utf8 |
| Character_set_system | utf8 |
| Character_sets_dir | D :\ mysql-5.1.32-win32 \ share \ charsets \ |
 
In this case, run the set names 'gbk' command on the console and show variables like 'Char % 'again. The result is as follows:
 
+ -------------------------- + ----------------------------------------- +
| Variable_name | Value |
+ -------------------------- + ----------------------------------------- +
| Character_set_client | gbk |
| Character_set_connection | gbk |
| Character_set_database | utf8 |
| Character_set_filesystem | binary |
| Character_set_results | gbk |
| Character_set_server | utf8 |
| Character_set_system | utf8 |
| Character_sets_dir | D :\ mysql-5.1.32-win32 \ share \ charsets \ |
 
The client connection environment is complete. Then, how to insert Chinese data or how to insert it will not be garbled.
 
To import data in batches from. SQL .txt and other texts, You need to convert the corresponding file into gbk format and save it before importing it. Otherwise, garbled characters will occur after the import.

If the output encoding format is not the above format, you can also modify it using the following SQL statement. The MYSQL Command sets the encoding format: set character_set_server = 'utf8'. For more information, see the source: http://blog.csdn.net/pearyangyang/article/details/46127005



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.