There is a very formal database backup method using MYSQL, which has the same concept as other database servers. But have you ever thought that MySQL has a simpler backup method using file directories, which is faster and better.
1. Data backup shortcut
Because this method has not been verified by official documents, we will temporarily call it a trial.
Purpose: Back up a MySQL database TestA in hostA and restore it to hostB
Test environment:
Operating system: WinNT4.0, MySQL3.22.34, PHPMyAdmin 2.1. 0 Chinaz
Install MySQL database in hostA and create TestA database
HostB installs MySQL database and does not have TestA database
Method steps:
Start PHPMyAdmin to view HostA and Database list in HostB, there is no TestA database in HostB
Find the installation directory of MySQL in HostA, and find the database directory data
In my test environment, This directory is
C:MySQLdata
Find the subdirectory corresponding to the database name
C:MySQLdataTestA
Paste and copy it to the Data directory of HostB Below, the files in the MySQL data directory of HostA and HostB are the same
Refresh HostB’s PHPMyAdmin and check the database list. We see that TestA has appeared, and operations such as query modification and other operations are normal, and the backup and recovery are successful
Test conclusion: MySQL database can be saved, backed up, and restored in the form of a file, as long as the corresponding file directory is restored, without the need to use other tools for backup.