STEP2:删除测试数据库lijiamandb,并关闭数据库
[root@mysqlserver backup]# mysql -uroot -p123456
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 26
Server version: 5.7.27 MySQL Community Server (GPL)
IMPORTANT: Please check that the copy-back run completes successfully.
At the end of a successful copy-back run innobackupex
prints "completed OK!".
innobackupex version 2.4.18 based on MySQL server 5.7.26 Linux (x86_64) (revision id: 29b4ca5)
Original data directory /usr/local/mysql/data is not empty!
STEP3:删除测试数据,看最终是否可以恢复回来
[root@mysqlserver backup]# mysql -uroot -p123456
mysql> use lijiamandb;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select count(*) from test01;
+----------+
| count(*) |
+----------+
| 10000 |
+----------+
1 row in set (0.01 sec)
mysql> select count(*) from test02;
+----------+
| count(*) |
+----------+
| 10000 |
+----------+
1 row in set (0.00 sec)
STEP9:重启数据库,确认数据已经恢复回来
[root@mysqlserver mysql]# service mysqld start
Starting MySQL.Logging to '/usr/local/mysql/data/mysqlserver.err'.
SUCCESS!
[root@mysqlserver mysql]# mysql -uroot -p123456
mysql> use lijiamandb;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select count(*) from test01;
+----------+
| count(*) |
+----------+
| 10000 |
+----------+
1 row in set (0.00 sec)
mysql> select count(*) from test02;
+----------+
| count(*) |
+----------+
| 10000 |
+----------+
1 row in set (0.01 sec)