MySQL database under Windows platform Import to Linux platform

Source: Internet
Author: User
Tags mysql client

In general, when MySQL migrates from Windows to Linux, there are standard tutorials on the Web:

1) Enter the/mysql/bin directory on the Windows platform (assuming your database name is MyData)
Execute the mysqldump command to export your database, with the following specific commands:
Mysqldump-u root-h localhost-p-R c://mydata.txt-b MyData
The result of executing this command is: Generate a text file under c:/

(2) Upload the MyData.txt file to a folder under Linux (if placed under/home/installsoft),
Start MySQL on the Linux platform and execute the./mysql-u root-p command into the MySQL client program
Execute the following command:
Mysql>source/home/installsoft/mydata.txt can successfully complete the migration

But there are a lot of problems with migrating past data, and the main possible reason is that there may be a problem with migrating past character encodings:

The best solution is to now set the character encoding on both sides to the same encoding, and then migrate the database to the past, and set the encoding in the following way:

First look at the character encoding commands: Show variables like ' character% ';

Then compare the character encoding on Windows and Linux in the same, if not consistent, can be resolved with the following MySQL command:

Set character_set_client=gb2312 resolved.

Character_set_client can be replaced by other character sets, gb2312 can also be replaced by other character encodings.

MySQL database under Windows platform Import to Linux platform

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.