MySQL database migrated from Windows to Linux

Source: Internet
Author: User
Tags filezilla

A few days ago to build a lamp environment, want to write a small thing to move to Linux running, involving the MySQL database files migrated to Linux, directly with the FileZilla pass the past should not, I tried, anyway did not succeed. Here's how I used it:

(i) Export the database file with the mysqldump command:

Under Windows CD to the bin directory of MySQL:


C:/data.txt this directory and the exported text name can be arbitrarily taken, b after the table name, I want to export the show is called user. After entering the password, you can go to save the directory to see if there is no data files, and some words will succeed, it is possible to feel that the failure is not a CD to the bin directory of MySQL or the path is wrong and most likely error is not run with administrator privileges, will appear errcode:13- Permission denied.

(ii) Use FileZilla to upload data.txt text files to Linux:

This is simple.

(c) Open Linux, go to MySQL, move into the database:

It is recommended to look at the database encoding format before moving into the database, otherwise it will cause the Chinese in the data to become garbled


The result is that this is correct, because the default encoding format for MySQL is Latin1.
Modify the encoding format is in the ETC directory my.cnf inside the change,

Add these several places:
[Mysqld]
Character-set-server=utf8
Collation_server=utf_general_ci
init_connect= ' SET NAMES UTF8 '
[Client]
Default-character-set=utf8
Then restart the MySQL service, enter MySQL, use show variables like "%char%"; command to view the code.
Once the UTF8 encoding is confirmed, you can begin migrating the database files.

The source command is followed by the location of the FileZilla to the text file on Linux. After you finish the above steps, the database migration is complete.

                </div>

MySQL database migrated from Windows to Linux

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.