您好,登錄后才能下訂單哦!
這篇文章給大家介紹xtrabackup 8備份Mysql 8.0.18的過程是怎么樣的,內容非常詳細,感興趣的小伙伴們可以參考借鑒,希望對大家能有所幫助。
1、首先 在mysql8里先建了一個稍微大一點的測試表,腳本:
CREATE TABLE user100w( id INT NOT NULL AUTO_INCREMENT, first_name VARCHAR(10) NOT NULL, last_name VARCHAR(10) NOT NULL, sex VARCHAR(5) NOT NULL, score INT NOT NULL, copy_id INT NOT NULL, PRIMARY KEY (`id`)); DROP PROCEDURE IF EXISTS add_user; DELIMITER // create PROCEDURE add_user(in num INT) BEGIN DECLARE rowid INT DEFAULT 0; DECLARE firstname CHAR(1); DECLARE name1 CHAR(1); DECLARE name2 CHAR(1); DECLARE lastname VARCHAR(3) DEFAULT ''; DECLARE sex CHAR(1); DECLARE score CHAR(2); WHILE rowid < num DO SET firstname = SUBSTRING('趙錢孫李周吳鄭王林楊柳劉孫陳江阮侯鄒高彭徐',FLOOR(1+21*RAND()),1); SET name1 = SUBSTRING('一二三四五六七八九十甲乙丙丁靜景京晶名明銘敏閔民軍君俊駿天田甜兲恬益依成城誠立莉力黎勵',ROUND(1+43*RAND()),1); SET name2 = SUBSTRING('一二三四五六七八九十甲乙丙丁靜景京晶名明銘敏閔民軍君俊駿天田甜兲恬益依成城誠立莉力黎勵',ROUND(1+43*RAND()),1); SET sex=FLOOR(0 + (RAND() * 2)); SET score= FLOOR(40 + (RAND() *60)); SET rowid = rowid + 1; IF ROUND(RAND())=0 THEN SET lastname =name1; END IF; IF ROUND(RAND())=1 THEN SET lastname = CONCAT(name1,name2); END IF; insert INTO user100w (first_name,last_name,sex,score,copy_id) VALUES (firstname,lastname,sex,score,rowid); END WHILE; END //DELIMITER ; call add_user(10000);
2、yum安裝依賴
[root@centos1 ~]# yum install libev
3、下載xtrabackup后,直接用yum安裝
[root@centos1 opt]# wget https://www.percona.com/downloads/Percona-XtraBackup-LATEST/Percona-XtraBackup-8.0-7/binary/redhat/7/x86_64/percona-xtrabackup-80-8.0.7-1.el7.x86_64.rpm
Saving to: ‘percona-xtrabackup-80-8.0.7-1.el7.x86_64.rpm’ 100%[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=======================>] 12,177,712 22.2KB/s in 2m 20s 2019-11-08 17:39:37 (21.5 KB/s) - ‘percona-xtrabackup-80-8.0.7-1.el7.x86_64.rpm’ saved [12177712/12177712] [root@centos1 opt]# yum localinstall percona-xtrabackup-80-8.0.7-1.el7.x86_64.rpm Installed: percona-xtrabackup-80.x86_64 0:8.0.7-1.el7 Dependency Installed: perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 perl-DBD-MySQL.x86_64 0:4.023-6.el7 perl-DBI.x86_64 0:1.627-4.el7 perl-Digest.noarch 0:1.17-245.el7 perl-Digest-MD5.x86_64 0:2.52-3.el7 perl-IO-Compress.noarch 0:2.061-2.el7 perl-Net-Daemon.noarch 0:0.48-5.el7 perl-PlRPC.noarch 0:0.2020-14.el7 Complete! [root@centos1 opt]# xtrabackup -vxtrabackup: recognized server arguments: --datadir=/var/lib/mysql xtrabackup version 8.0.7 based on MySQL server 8.0.16 Linux (x86_64) (revision id: 069e0e6)
問題來了 我的mysql是8.0.18的(裝好之后發現并沒有什么問題)
4、開始備份
一些參數:
According to your system, you may need to specify one or more of the following options to connect to the server:
Option | Description |
---|---|
–port | The port to use when connecting to the database server with TCP/IP. |
–socket | The socket to use when connecting to the local database. |
–host | The host to use when connecting to the database server with TCP/IP. |
備份(如果不是localhost的遠程備份的話,mysql需要更新User表可以遠程登錄):
[mysql@centos1 ~]$ xtrabackup --defaults-file=/data/mysql/my.cnf --host=localhost --user=root --password=mysqlWAI --port=3306 --socket=/data/mysql/run/mysql.sock --backup --target-dir=/home/mysql/xbackup/
備份時插入一條數據做測試
mysql> select * from test1 ;+------+------+| id | code |+------+------+| 1 | 3009 || 2 | 3010 || 3 | 3011 |+------+------+3 rows in set (0.00 sec) mysql> insert into test1 values(4,3099);
備份完成會提示:
191111 18:09:24 All tables unlocked 191111 18:09:24 Backup created in directory '/home/mysql/xbackup/' MySQL binlog position: filename 'mysql-bin.000004', position '155' 191111 18:09:24 [00] Writing /home/mysql/xbackup/backup-my.cnf 191111 18:09:24 [00] ...done 191111 18:09:24 [00] Writing /home/mysql/xbackup/xtrabackup_info 191111 18:09:24 [00] ...done xtrabackup: Transaction log of lsn (23556373) to (23556739) was copied. 191111 18:09:24 completed OK!
查看一下備份的情況
[mysql@centos1 xbackup]$ ll total 2142252 -rw-r----- 1 mysql mysql 499 Nov 11 18:09 backup-my.cnf -rw-r----- 1 mysql mysql 2147483648 Nov 11 18:09 ibdata1 drwxr-x--- 2 mysql mysql 157 Nov 11 18:09 mysql -rw-r----- 1 mysql mysql 155 Nov 11 18:09 mysql-bin.000004 -rw-r----- 1 mysql mysql 36 Nov 11 18:09 mysql-bin.index -rw-r----- 1 mysql mysql 25165824 Nov 11 18:09 mysql.ibd drwxr-x--- 2 mysql mysql 8192 Nov 11 18:09 performance_schema drwxr-x--- 2 mysql mysql 43 Nov 11 18:09 srlg drwxr-x--- 2 mysql mysql 28 Nov 11 18:09 sys -rw-r----- 1 mysql mysql 10485760 Nov 11 18:09 undo_001 -rw-r----- 1 mysql mysql 10485760 Nov 11 18:09 undo_002 -rw-r----- 1 mysql mysql 21 Nov 11 18:09 xtrabackup_binlog_info -rw-r----- 1 mysql mysql 95 Nov 11 18:09 xtrabackup_checkpoints -rw-r----- 1 mysql mysql 581 Nov 11 18:09 xtrabackup_info -rw-r----- 1 mysql mysql 3072 Nov 11 18:09 xtrabackup_logfile -rw-r----- 1 mysql mysql 264 Nov 11 18:09 xtrabackup_tablespaces
[mysql@centos1 xbackup]$ cat xtrabackup_checkpoints backup_type = full-backuped from_lsn = 0 to_lsn = 23556719 last_lsn = 23556729 flushed_lsn = 0
[mysql@centos1 xbackup]$ cat xtrabackup_info uuid = 562944f7-046b-11ea-984b-10e7c62c3e49 name = tool_name = xtrabackup tool_command = --defaults-file=/data/mysql/my.cnf --host=localhost --user=root --password=... --port=3306 --socket=/data/mysql/run/mysql.sock --backup --target-dir=/home/mysql/xbackup/ tool_version = 8.0.7 ibbackup_version = 8.0.7 server_version = 8.0.18 start_time = 2019-11-11 18:08:43 end_time = 2019-11-11 18:09:24 lock_time = 0 binlog_pos = filename 'mysql-bin.000004', position '155' innodb_from_lsn = 0 innodb_to_lsn = 23556719 partial = N incremental = N format = file compressed = N encrypted = N
此時刪掉mysql一個表作測試
mysql> show tables -> ;+----------------+| Tables_in_srlg |+----------------+| test1 || user100w |+----------------+2 rows in set (0.00 sec) mysql> drop table user100w;Query OK, 0 rows affected (0.10 sec)
創建備份用戶根據官方:
An SQL example of creating a database user with the minimum privileges required to full backups would be:
mysql> CREATE USER 'bkpuser'@'localhost' IDENTIFIED BY 's3cr%T'; mysql> GRANT BACKUP_ADMIN, PROCESS, RELOAD, LOCK TABLES, REPLICATION CLIENT ON *.* TO 'bkpuser'@'localhost' ; mysql> GRANT SELECT ON performance_schema.log_status TO 'bkpuser'@'localhost' ; mysql> FLUSH PRIVILEGES;
準備恢復
[mysql@centos1 ~]$ xtrabackup --defaults-file=/data/mysql/my.cnf --user=root --prepare --target-dir=/home/mysql/xbackup/ Created 128 and tracked 128 new rollback segment(s) in the temporary tablespace. 128 are now active.Page cleaner took 23005ms to flush 0 and evict 0 pages8.0.16 started; log sequence number 23557132xtrabackup: starting shutdown with innodb_fast_shutdown = 1FTS optimize thread exiting.Starting shutdown...Log background threads are being closed...Shutdown completed; log sequence number 23557132191111 18:32:11 completed OK![mysql@centos1 ~]$ [mysql@centos1 ~]$ xtrabackup --defaults-file=/data/mysql/my.cnf--user=root --copy-back --target-dir=/home/mysql/xbackup/
報錯
[mysql@centos1 ~]$ xtrabackup --defaults-file=/data/mysql/my.cnf--user=root --copy-back --target-dir=/home/mysql/xbackup/ xtrabackup: [ERROR] Failed to open required defaults file: /data/mysql/my.cnf--user=root xtrabackup: [ERROR] Fatal error in defaults handling. Program aborted!
修改權限
[root@centos1 mysql]# chmod 755 /data/mysql/my.cnf
[mysql@centos1 ~]$ xtrabackup --defaults-file=/data/mysql/my.cnf --user=mysql --copy-back --target-dir=/home/mysql/xbackup/ xtrabackup: recognized server arguments: --datadir=/data/mysql/data --tmpdir=/data/mysql/tmp --open_files_limit=65535 --server-id=1 --log_bin=/data/mysql/binlog/mysql-bin --innodb_buffer_pool_size=4096M --innodb_file_per_table=1 --innodb_data_home_dir=/data/mysql/innodb_ts --innodb_data_file_path=ibdata1:2048M:autoextend --innodb_log_buffer_size=67108864 --innodb_log_file_size=1048576000 --innodb_log_files_in_group=4 --innodb_undo_directory=/data/mysql/undo_space --innodb_log_group_home_dir=/data/mysql/innodb_log --innodb_flush_log_at_trx_commit=2 --innodb_max_dirty_pages_pct=60 --innodb_open_files=60000 --innodb_read_io_threads=4 --innodb_flush_method=O_DIRECT xtrabackup: recognized client arguments: --port=3306 --socket=/data/mysql/run/mysql.sock --user=mysql --copy-back=1 --target-dir=/home/mysql/xbackup/ xtrabackup version 8.0.7 based on MySQL server 8.0.16 Linux (x86_64) (revision id: 069e0e6) Original data directory /data/mysql/data is not empty!
oh 對了恢復的話 相關文件目錄/data/mysql/data要刪掉。。。 重來吧
看看備份目錄內容 多了一些日志:
[mysql@centos1 data]$ cd /home/mysql/xbackup [mysql@centos1 xbackup]$ ll total 6258732 -rw-r----- 1 mysql mysql 499 Nov 11 18:09 backup-my.cnf -rw-r----- 1 mysql mysql 2147483648 Nov 11 18:32 ibdata1 -rw-r----- 1 mysql mysql 1048576000 Nov 11 18:32 ib_logfile0 -rw-r----- 1 mysql mysql 1048576000 Nov 11 18:31 ib_logfile1 -rw-r----- 1 mysql mysql 1048576000 Nov 11 18:31 ib_logfile2 -rw-r----- 1 mysql mysql 1048576000 Nov 11 18:32 ib_logfile3 -rw-r----- 1 mysql mysql 12582912 Nov 11 18:32 ibtmp1 drwxrwx--- 2 mysql mysql 6 Nov 11 18:32 #innodb_temp drwxr-x--- 2 mysql mysql 157 Nov 11 18:09 mysql -rw-r----- 1 mysql mysql 155 Nov 11 18:09 mysql-bin.000004 -rw-r----- 1 mysql mysql 36 Nov 11 18:09 mysql-bin.index -rw-r----- 1 mysql mysql 25165824 Nov 11 18:09 mysql.ibd drwxr-x--- 2 mysql mysql 8192 Nov 11 18:09 performance_schema drwxr-x--- 2 mysql mysql 43 Nov 11 18:09 srlg drwxr-x--- 2 mysql mysql 28 Nov 11 18:09 sys -rw-r----- 1 mysql mysql 10485760 Nov 11 18:09 undo_001 -rw-r----- 1 mysql mysql 10485760 Nov 11 18:09 undo_002 -rw-r----- 1 mysql mysql 21 Nov 11 18:09 xtrabackup_binlog_info -rw-r----- 1 mysql mysql 95 Nov 11 18:31 xtrabackup_checkpoints -rw-r----- 1 mysql mysql 581 Nov 11 18:09 xtrabackup_info -rw-r----- 1 mysql mysql 8388608 Nov 11 18:31 xtrabackup_logfile -rw-rw-r-- 1 mysql mysql 1 Nov 11 18:31 xtrabackup_master_key_id -rw-r----- 1 mysql mysql 264 Nov 11 18:32 xtrabackup_tablespaces
[mysql@centos1 xbackup]$ cd /data/mysql [mysql@centos1 mysql]$ ll total 36 drwxrwxr-x 2 mysql mysql 6 Oct 30 15:31 backup drwxrwxr-x 2 mysql mysql 125 Nov 11 18:09 binlog drwxr-xr-x 7 mysql mysql 288 Nov 8 11:25 data drwxrwxr-x 2 mysql mysql 82 Oct 31 11:29 innodb_log drwxrwxr-x 2 mysql mysql 57 Nov 8 11:25 innodb_ts drwxr-xr-x 2 mysql mysql 6 Oct 25 16:29 log -rwxr-xr-x 1 mysql mysql 2690 Oct 31 12:02 my.cnf -rw-r----- 1 mysql mysql 6 Nov 8 11:25 mysqld.pid -rw-r----- 1 mysql mysql 24410 Nov 11 18:08 mysql-error.log drwxr-xr-x 2 mysql mysql 90 Nov 8 11:25 run drwxrwxr-x 2 mysql mysql 6 Oct 30 15:31 scripts -rw-r----- 1 mysql mysql 744 Nov 8 13:23 slow_statement.log drwxr-xr-x 3 mysql mysql 53 Oct 29 17:26 tmp drwxr-x--- 2 mysql mysql 38 Oct 31 11:29 undo_space [mysql@centos1 mysql]$ mv data data_bk [mysql@centos1 mysql]$ mv binlog binlog_bk [mysql@centos1 mysql]$ mv innodb_log innodb_log_bk [mysql@centos1 mysql]$ cd innodb_ts/ [mysql@centos1 innodb_ts]$ ll total 2109448 -rw-r----- 1 mysql mysql 4509 Oct 31 17:34 ib_buffer_pool -rw-r----- 1 mysql mysql 2147483648 Nov 11 18:34 ibdata1 -rw-r----- 1 mysql mysql 12582912 Nov 8 11:26 ibtmp1 [mysql@centos1 innodb_ts]$ cd .. [mysql@centos1 mysql]$ mv innodb_ts innodb_ts_bk [mysql@centos1 mysql]$ cd log [mysql@centos1 log]$ ll total 0 [mysql@centos1 log]$ cd .. [mysql@centos1 mysql]$ cd tmp [mysql@centos1 tmp]$ ll total 113284 drwxr-xr-x 8 root root 319 Apr 10 2019 boost_1_70_0 -rw-r--r-- 1 root root 116000903 Oct 29 17:26 boost_1_70_0.tar.gz [mysql@centos1 tmp]$ cd .. [mysql@centos1 mysql]$ cd undo_space/ [mysql@centos1 undo_space]$ ll total 20480 -rw-r----- 1 mysql mysql 10485760 Nov 11 18:34 undo_001 -rw-r----- 1 mysql mysql 10485760 Nov 11 18:33 undo_002 [mysql@centos1 undo_space]$ cd .. [mysql@centos1 mysql]$ mv undo_space undo_space_bk [mysql@centos1 mysql]$ ll total 36 drwxrwxr-x 2 mysql mysql 6 Oct 30 15:31 backup drwxrwxr-x 2 mysql mysql 125 Nov 11 18:09 binlog_bk drwxr-xr-x 7 mysql mysql 288 Nov 8 11:25 data_bk drwxrwxr-x 2 mysql mysql 82 Oct 31 11:29 innodb_log_bk drwxrwxr-x 2 mysql mysql 57 Nov 8 11:25 innodb_ts_bk drwxr-xr-x 2 mysql mysql 6 Oct 25 16:29 log -rwxr-xr-x 1 mysql mysql 2690 Oct 31 12:02 my.cnf -rw-r----- 1 mysql mysql 6 Nov 8 11:25 mysqld.pid -rw-r----- 1 mysql mysql 24410 Nov 11 18:08 mysql-error.log drwxr-xr-x 2 mysql mysql 90 Nov 8 11:25 run drwxrwxr-x 2 mysql mysql 6 Oct 30 15:31 scripts -rw-r----- 1 mysql mysql 744 Nov 8 13:23 slow_statement.log drwxr-xr-x 3 mysql mysql 53 Oct 29 17:26 tmp drwxr-x--- 2 mysql mysql 38 Oct 31 11:29 undo_space_bk
這樣很多很麻煩啊。。對了我直接刪掉整個目錄就好了吧。。。
[mysql@centos1 mysql]$ cd .. [mysql@centos1 data]$ ll total 0 drwxr-xr-x 12 mysql mysql 243 Nov 12 11:00 mysql [mysql@centos1 data]$ mv mysql mysql_bk mv: cannot move ‘mysql’ to ‘mysql_bk’: Permission denied [mysql@centos1 data]$ ll total 0 drwxr-xr-x 12 mysql mysql 243 Nov 12 11:00 mysql [mysql@centos1 data]$ su - root Password: su: Authentication failure [mysql@centos1 data]$ su - root Password: Last login: Tue Nov 12 10:40:42 CST 2019 from desktop-v9u5026 on pts/1 Last failed login: Tue Nov 12 11:04:08 CST 2019 on pts/1 There was 1 failed login attempt since the last successful login. [root@centos1 ~]# chmod 755 /data/mysql [root@centos1 ~]# cd /data [root@centos1 data]# ll total 0 drwxr-xr-x 12 mysql mysql 243 Nov 12 11:00 mysql
[root@centos1 data]# chmod 777 /data/mysql [root@centos1 data]# ll total 0 drwxrwxrwx 12 mysql mysql 243 Nov 12 11:00 mysql [root@centos1 data]# su - mysql Last login: Tue Nov 12 10:45:32 CST 2019 on pts/1 [mysql@centos1 ~]$ cd /data [mysql@centos1 data]$ ll total 0 drwxrwxrwx 12 mysql mysql 243 Nov 12 11:00 mysql [mysql@centos1 data]$ mv mysql mysql_bk mv: cannot move ‘mysql’ to ‘mysql_bk’: Permission denied [mysql@centos1 data]$ ll total 0 drwxrwxrwx 12 mysql mysql 243 Nov 12 11:00 mysql [mysql@centos1 data]$ cd [mysql@centos1 ~]$ pwd /home/mysql
好吧 不行mv不了 還是按剛剛那樣吧
重新做恢復的過程,先看看進程吧
[mysql@centos1 mysql]$ ps -ef|grep mysql root 8867 8496 0 10:45 pts/1 00:00:00 su - mysql mysql 8868 8867 0 10:45 pts/1 00:00:00 -bash mysql 9850 1 0 Nov08 ? 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=/data/mysql/my.cnf --user=mysql root 10468 10216 0 11:07 pts/1 00:00:00 su - mysql mysql 10469 10468 0 11:07 pts/1 00:00:00 -bash mysql 10738 9850 0 Nov08 ? 00:48:01 /usr/local/mysql/bin/mysqld --defaults-file=/data/mysql/my.cnf --basedir=/usr/localmysql --datadir=/data/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/data/mysql/mysql-error.log --open-files-limit=65535 --pid-file=/data/mysql/mysqld.pid --socket=/data/mysql/run/mysql.sock --port=3306 mysql 11009 10469 0 11:14 pts/1 00:00:00 ps -ef mysql 11010 10469 0 11:14 pts/1 00:00:00 grep --color=auto mysql
什么鬼?我記得我停掉mysql了啊 竟然忘了? 那當然不能mv mysql了啊 暈。。。
停掉mysql
[mysql@centos1 bin]$ /usr/local/mysql/bin/mysqladmin -h 127.0.0.1 -uroot -pmysqlWAI -P3306 -S /data/mysql/run/mysql.sock shutdown mysqladmin: [Warning] Using a password on the command line interface can be insecure. [mysql@centos1 bin]$ ps -ef|grep mysql root 8867 8496 0 10:45 pts/1 00:00:00 su - mysql mysql 8868 8867 0 10:45 pts/1 00:00:00 -bash root 10468 10216 0 11:07 pts/1 00:00:00 su - mysql mysql 10469 10468 0 11:07 pts/1 00:00:00 -bash mysql 11341 10469 0 11:19 pts/1 00:00:00 ps -ef mysql 11342 10469 0 11:19 pts/1 00:00:00 grep --color=auto mysql
重新創建空目錄
[mysql@centos1 mysql]$ mkdir data [mysql@centos1 mysql]$ mkdir binlog [mysql@centos1 mysql]$ mkdir innodb_log [mysql@centos1 mysql]$ mkdir innodb_ts [mysql@centos1 mysql]$ mkdir undo_space [mysql@centos1 mysql]$ mv tmp tmp_bk [mysql@centos1 mysql]$ mkdir tmp
準備恢復 --prepare (這個好像是將備份集備份后MySQL運行產生的日志合并之類的)
[mysql@centos1 mysql]$ xtrabackup --defaults-file=/data/mysql/my.cnf --user=root --prepare --target-dir=/home/mysql/xbackup/ Creating shared tablespace for temporary tables Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... File './ibtmp1' size is now 12 MB. Scanning temp tablespace dir:'./#innodb_temp/' Created 128 and tracked 128 new rollback segment(s) in the temporary tablespace. 128 are now active. 8.0.16 started; log sequence number 23557132 xtrabackup: starting shutdown with innodb_fast_shutdown = 1 FTS optimize thread exiting. Starting shutdown... Log background threads are being closed... Shutdown completed; log sequence number 23557132 191112 11:30:58 completed OK!
跟上次的序列號是一樣的 大概是因為沒有產生過數據變更
--copy-back:
[mysql@centos1 ~]$ xtrabackup --defaults-file=/data/mysql/my.cnf --user=mysql --copy-back --target-dir=/home/mysql/xbackup/ 191112 11:38:32 [01] Copying ./xtrabackup_info to /data/mysql/data/xtrabackup_info 191112 11:38:32 [01] ...done 191112 11:38:32 [01] Copying ./xtrabackup_master_key_id to /data/mysql/data/xtrabackup_master_key_id 191112 11:38:32 [01] ...done 191112 11:38:32 [01] Copying ./ibtmp1 to /data/mysql/data/ibtmp1 191112 11:38:32 [01] ...done 191112 11:38:32 [01] Creating directory ./#innodb_temp 191112 11:38:32 [01] ...done. 191112 11:38:32 completed OK!
查看恢復后的文件,新建的文件夾有數據了:
[mysql@centos1 ~]$ cd /data/mysql [mysql@centos1 mysql]$ ll total 36 drwxrwxr-x 2 mysql mysql 6 Oct 30 15:31 backup drwxrwxr-x 2 mysql mysql 53 Nov 12 11:38 binlog drwxrwxr-x 2 mysql mysql 125 Nov 11 18:09 binlog_bk drwxrwxr-x 6 mysql mysql 154 Nov 12 11:38 data drwxr-xr-x 7 mysql mysql 288 Nov 8 11:25 data_bk drwxrwxr-x 2 mysql mysql 82 Nov 12 11:37 innodb_log drwxrwxr-x 2 mysql mysql 82 Oct 31 11:29 innodb_log_bk drwxrwxr-x 2 mysql mysql 21 Nov 12 11:37 innodb_ts drwxrwxr-x 2 mysql mysql 57 Nov 8 11:25 innodb_ts_bk drwxr-xr-x 2 mysql mysql 6 Oct 25 16:29 log -rwxr-xr-x 1 mysql mysql 2690 Oct 31 12:02 my.cnf -rw-r----- 1 mysql mysql 25145 Nov 12 11:18 mysql-error.log drwxr-xr-x 2 mysql mysql 6 Nov 12 11:18 run drwxrwxr-x 2 mysql mysql 6 Oct 30 15:31 scripts -rw-r----- 1 mysql mysql 744 Nov 8 13:23 slow_statement.log drwxrwxr-x 2 mysql mysql 6 Nov 12 11:25 tmp drwxr-xr-x 3 mysql mysql 53 Oct 29 17:26 tmp_bk drwxrwxr-x 2 mysql mysql 38 Nov 12 11:37 undo_space drwxr-x--- 2 mysql mysql 38 Oct 31 11:29 undo_space_bk [mysql@centos1 mysql]$ cd data [mysql@centos1 data]$ ll total 36884 -rw-r----- 1 mysql mysql 12582912 Nov 12 11:38 ibtmp1 drwxr-x--- 2 mysql mysql 157 Nov 12 11:38 mysql -rw-r----- 1 mysql mysql 25165824 Nov 12 11:38 mysql.ibd drwxr-x--- 2 mysql mysql 8192 Nov 12 11:38 performance_schema drwxr-x--- 2 mysql mysql 43 Nov 12 11:38 srlg drwxr-x--- 2 mysql mysql 28 Nov 12 11:38 sys -rw-r----- 1 mysql mysql 581 Nov 12 11:38 xtrabackup_info -rw-r----- 1 mysql mysql 1 Nov 12 11:38 xtrabackup_master_key_id [mysql@centos1 data]$ cd .. [mysql@centos1 mysql]$ cd binlog [mysql@centos1 binlog]$ ll total 8 -rw-r----- 1 mysql mysql 155 Nov 12 11:38 mysql-bin.000004 -rw-r----- 1 mysql mysql 36 Nov 12 11:38 mysql-bin.index
啟動mysql:
[mysql@centos1 ~]$ /usr/local/mysql/bin/mysqld_safe --defaults-file=/data/mysql/my.cnf --user=mysql & [1] 13666 [mysql@centos1 ~]$ 2019-11-12T03:51:22.072187Z mysqld_safe Logging to '/data/mysql/mysql-error.log'. 2019-11-12T03:51:22.147329Z mysqld_safe Starting mysqld daemon with databases from /data/mysql/data
[mysql@centos1 ~]$ ps -ef |grep mysql root 8867 8496 0 10:45 pts/1 00:00:00 su - mysql mysql 8868 8867 0 10:45 pts/1 00:00:00 -bash root 10468 10216 0 11:07 pts/1 00:00:00 su - mysql mysql 10469 10468 0 11:07 pts/1 00:00:00 -bash root 12670 12624 0 11:37 pts/0 00:00:00 su - mysql mysql 12671 12670 0 11:37 pts/0 00:00:00 -bash mysql 13666 12671 0 11:51 pts/0 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=/data/mysql/my.cnf --user=mysql mysql 14555 13666 5 11:51 pts/0 00:00:01 /usr/local/mysql/bin/mysqld --defaults-file=/data/mysql/my.cnf --basedir=/usr/localmysql --datadir=/data/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/data/mysql/mysql-error.log --open-files-limit=65535 --pid-file=/data/mysql/mysqld.pid --socket=/data/mysql/run/mysql.sock --port=3306 root 14666 14621 0 11:51 pts/2 00:00:00 su - mysql mysql 14667 14666 0 11:51 pts/2 00:00:00 -bash mysql 14713 14667 0 11:51 pts/2 00:00:00 ps -ef mysql 14714 14667 0 11:51 pts/2 00:00:00 grep --color=auto mysql
登錄
[mysql@centos1 ~]$ mysql -uroot -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 8Server version: 8.0.18 nancy edition Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use srlgDatabase changedmysql> show tables;+----------------+| Tables_in_srlg |+----------------+| test1 || user100w |+----------------+2 rows in set (0.02 sec) mysql> select * from test1;+------+------+| id | code |+------+------+| 1 | 3009 || 2 | 3010 || 3 | 3011 || 4 | 3099 |+------+------+4 rows in set (0.02 sec) mysql> select count(*) from user100w;+----------+| count(*) |+----------+| 10000 |+----------+1 row in set (0.02 sec)
查看備份時候插入的數據,以及備份之后刪除的表都存在。
關于xtrabackup 8備份Mysql 8.0.18的過程是怎么樣的就分享到這里了,希望以上內容可以對大家有一定的幫助,可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。