Mysqldump backup database Chinese garbled characters and MySQL import database Chinese garbled solution 1

Source: Internet
Author: User
Tags import database mysql command line mysql import mysql import database
Mysqldump backup database Chinese garbled characters and MySQL import database Chinese garbled solution 1

Mysqldump backup database Chinese garbled solution 1

If the character set on the MySQL server is Latin1, Chinese characters from mysqldump are garbled! A simple method is to add the default character set options, such:
Mysqldump-H 127.0.0.1-P 3307-u username -- default-character-set = GBK-P databasename> dumpfile.txt
-H host
-P port. This option must be used separately, but cannot be consecutively written after the host address.
-U User Name
-- When the default-character-set knows that the data content is Chinese, it can be specified as GBK, so that even if the database itself sets the character set to the Chinese language of the file Latin1, it can be normal!
-P Password
Databasename Database Name
> The following is the path of the output file.

 

Garbled characters occur when MySQL command line imports data

Sometimes, because the SQL data volume is large and you need to import data under the command line, garbled characters may occur in the imported data. Execute the following command to solve the problem:
1. Use Database;

2. Set Character Set utf8; (eg: GBK)

3. Source example. SQL (SQL file path)

 

 

 

 

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.