mysql| Backup | data | database
2 Backup and copy methods using the direct copy database
Another way to not involve mysqldump backup databases and tables is to copy the database table files directly. Typically, this is used as a CP, tar, or cpio utility. Examples of this article use CP.
When you use a direct backup method, you must ensure that the table is not in use. If the server changes when you are copying a table, the copy loses its meaning.
The best way to ensure your copy integrity is to shut down the server, copy the files, and reboot the server. If you do not want to shut down the server, lock the server while performing a table check. If the server is running, the same restrictions apply to copying files, and you should use the same locking protocol to "calm down" the server.
Assuming the server is down or you have locked the table you want to copy, the following shows how to back up the entire samp_db database to a backup directory (DataDir represents the server's data directory):
When you have completed the backup, you can reboot the server (if it is turned off) or release the lock added to the table (if you let the server run).
To copy a database from one machine to another using a direct copy file, just copy the file to the appropriate data directory on another server host. To make sure that the file is in myiasm format or that the two machines have the same hardware structure, your database has strange content on another host. You should also make sure that servers on another machine do not access them while you are installing the database tables.
3 Replicated databases (replicating database)
Replication (Replication) is similar to copying a database to another server, but its exact meaning is to ensure a full synchronization of two databases in real time. This feature will appear in version 3.23 and is not very mature, so this article is not covered in detail.
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