Troubleshooting of Chinese garbled characters in mysql import and export data _ MySQL

Source: Internet
Author: User
Tags mysql import
Troubleshooting of Chinese garbled characters in mysql import and export data bitsCN.com In linux

Linux uses utf8 encoding by default, while windows uses gbk encoding, so the above garbled characters may occur.

Solve the problem of garbled data during mysql import and export

The first thing to do is to determine the encoding format of the exported data. when using mysqldump, add -- default-character-set = utf8,

For example, the following code:
Mysqldump-uroot-p -- default-character-set = utf8 dbname tablename> bak. SQL


When importing data, use -- default-character-set = utf8:

Mysql-uroot-p -- default-character-set = utf8 dbname <bak. SQL

In this way, the unified encoding solves the garbled characters in mysql data migration.


I use windows as the data source for export and import the mysql database in the freebsd environment

Solution:

Export data

1. use mysql as the source for exporting databases on windows. View the system variables of the character encoding:


Mysql> show variables like '% char % ';
+ ――――――――

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.