MySQL database Migration instance by copying data files _mysql

Source: Internet
Author: User

MySQL database migration by copying data files

--Environment windows

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

I first install MySQL on target machine B, stop the MySQL service, and then copy the files and ibdata1 from the source machine A to the database, and the rest is not copied. As shown in figure:

SOURCE Machine A:

Start the target database service net start MySQL to view all the databases that are being directed.

Note: Ibdata1 must not forget the copy, and to copy to the exact location (such as my target machine ibdata1 in E:\MySQL datafiles, not the data path, I will first back up its ibdata1, and then copy to the E:\MySQL datafiles) Otherwise the query copies the past table will have an error:

mysql> use platform;

Database changed

mysql> show tables;

+-----------------------+

| Tables_in_platform  |

+-----------------------+

| mobile_scanner    |

| sharer        |

| sharer_mobile_scanner |

| Statistics      |

| Test         |

+-----------------------+

5 rows in Set (0.02 sec) 

mysql> desc test;

ERROR 1146 (42S02): Table ' platform.test ' doesn ' t exist 

Under Linux is similar to the way, but to note that after copying files, remember to change the data folder owner for MySQL.

Thank you for reading, I hope to help you, thank you for your support for this site!

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.