Full Export and Import implementation in mysql

Source: Internet
Author: User

At noon yesterday, I helped the carp to transfer database servers to a large group buying website. This article was supposed to be summarized after the transfer was completed yesterday. However, due to some reasons, I did not write it out in time. Now I want to make it up.
First, the environment is like this. in mysql 5.0, The centos system of the old database server has no web, no ftp, and the new database server mysql5.1 centos nginx.
The first idea of this environment is to use phpmyadmin for import and export, but the original database server does not have a web environment. In addition, the database file is about 300 MB, which cannot be imported only by phpmyadmin.
Prepare to stop mysql, package the database directory, and then overwrite the database directory of the new server, but the carp tried to say that there was a problem with the table segment in the past, so this method also gave up.
Run the following command on the old Server:
Copy codeThe Code is as follows:
Mysqldump-u username-p Database Name> database name. SQL


Export. after the SQL file is compressed by zip, it is transferred to the new database server through another server ssh (scp, use the following statement to import data (you can use mysqldump-u username-p database name <database name. SQL but want to see the execution progress, so the following operations are executed)
Copy codeThe Code is as follows:
Mysql-u root-p
Mysql> use Database
Mysql> source/data0/tuan. SQL


In this way, there will be a lot of entries to import ssh. We recommend that you use ssh to execute the command on the windows server. I use the company's network bandwidth to run 4 MB, occupying all my network speeds.
So far, the database transfer has let me get rid of it. There are not many technical things, but I just want to record it for myself to avoid forgetting and learn new things.

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.