What is the operation command of physical cold backup and recovery in the server?
This article mainly introduces what is the operation command of physical cold backup and recovery in the server. It is very detailed and has a certain reference value. Interested friends must finish reading it!
Physical cold backup usually packages the database folder directly with the tar command, while the mysql service needs to be turned off using the "systemctl stop mysqld" command before the backup.
1) back up the database
Create a / bak directory as the backup data storage path and use tar to create backup files. The entire database folder backup is a full backup.
[root@centos01 ~] # systemctl stop mysqld [root@centos01 ~] mkdir / bak/ [root@centos01 ~] # tar zcf / bak/mysql_all-$ (date +% F). Mysql.gz / usr/local/mysql/data/ [root@centos01 ~] # ls / bak/-rw-r--r-- 1 root root 766598 October 31 03:57 / bak/mysql_all-2019-10-31.mysql.gz2) Restore database [root@centos01 ~] mkdir test [root@centos01 ~] # tar zxvf / bak/mysql_all-2019-10-31.mysql.gz-C. / test/ [root@centos01 data] # cd / usr/local/mysql/data/ [root@centos01 data] # rm-rf. / * [root@centos01 ~] # cd. / test/usr/local/mysql/data/ [root@centos01 date] # mv. / * / usr/local/mysql/data/ [root@centos01 ~] # systemctl start mysqld is all the contents of the article "what are the operation commands for physical cold backup and recovery in the server" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!