Mysql migrates database instances by copying data files, and mysql copies

Source: Internet
Author: User

Mysql migrates database instances by copying data files, and mysql copies

Mysql migrates a database by copying data files.

-- Windows Environment

Copy the source machine database A to the target machine B:

I first install MySQL on the target machine B, stop the mysql service, and then copy the database files and ibdata1 files from the source machine A. The rest do not need to be copied.

Source machine:

Start the target database service net start mysql to view all the exported databases.

Note: Do not forget to copy ibdata1 and copy it to an accurate location (for example, the ibdata1 of the target machine is in E: \ MySQL Datafiles, not in the data path, back up ibdata1 and copy it to E: \ MySQL Datafiles. Otherwise, an error is returned when querying the copied table:

Mysql> use platform; Database changedmysql> show tables; + rule + | Tables_in_platform | + --------------------- + | mobile_stics | sharer | sharer_mobile_stics | statistics | test | + rule + 5 rows in set (0.02 sec) mysql> desc test; ERROR 1146 (42S02): Table 'Platform. test 'doesn' t exist

It is similar in Linux, but remember to change the data folder owner to mysql after copying the file.

Thank you for reading this article. I hope it will help you. Thank you for your support for this site!

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.