Using innobackupex to back up a single MySQL database
Purpose
Using innobackupex to back up a single MySQL database
Environment
OS: CentOS 6.6 32bit
Introduction
Official Website: https://www.percona.com/
Https://www.percona.com/downloads/XtraBackup/LATEST/
Operation
# Start backup
Innobackupex -- password = RedHat -- databases = db1/backup/
# Note: redhat is the root password of MySQL, db1 is the database I want to back up, And/backup/is the directory where my backups are stored (create a backup first ).
# Simulated recovery
# Stop a service
Service mysqld stop
# Clear the data directory (Note:/wwwroot/mysql/is my data directory)
Rm-rf/wwwroot/mysql /*
# Entering the prepare stage
Innobackupex -- apply-log/backup/2015-11-07_15-12-34/
# Entering the recovery phase
Innobackupex -- copy-back/backup/2015-11-07_15-12-34/
# Initializing a database through mysql_install_db
Cd/usr/local/webserver/mysql/
./Scripts/mysql_install_db -- user = mysql -- datadir =/wwwroot/mysql/
# Authorization
Chown-R mysql: mysql/wwwroot/mysql/
# Start the service
Service mysqld start
# Initialize the root password (Note: redhat is my password)
Mysqladmin-uroot password redhat
The above steps can be used to back up a single database, but I think it is useless. because we still need to back up the shared data source, that file is the largest, so it is better to back up the entire file directly.
XtraBackup and InnoBackupex online backup
This article permanently updates the link address: