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!