Solve the Problem of garbled data during mysql Import and Export

Source: Internet
Author: User
Tags mysql import
Recently, I used mysqldump in linux to export data. When I import data in windows, Chinese characters may be garbled and the following errors may occur: UnknownMySQLserverhost and Cantconnecttotheserver. To solve the problem of garbled data during mysql import and export, the encoding for unified import and export is used. In linux, the default encoding is utf8, while

Recently, I used mysqldump in linux to export data. When I import data in windows, Chinese characters may be garbled, which may lead: unknown MySQL server host and Can't connect to the server error. To solve the problem of garbled data during mysql import and export, the encoding for unified import and export is used. In linux, the default encoding is utf8, while

Recently, I used mysqldump in linux to export data. When I import data in windows, Chinese characters are garbled, and then the following occurs: unknown MySQL server host and Can't connect to the server error.

To solve the problem of garbled data during mysql import and export, the encoding for uniform import and export is used. The default encoding for linux is utf8 and for windows is gbk, so the above garbled code problem occurs.

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.

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.