1.源端mysql版本
[root@mysql57 ~]# mysql -V
mysql Ver 14.14 Distrib 5.7.36, for linux-glibc2.12 (x86_64) using EditLine wrapper
[root@mysql57 ~]# mysql -v
Welcome to the MySQL monitor. Commands end with ; or /g.
Your MySQL connection id is 4
Server version: 5.7.36-log MySQL Community Server (GPL)
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Reading history-file /root/.mysql_history
Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.
mysql> use testdb;
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 t1;
--------------
select count(*) from t1
--------------
+----------+
| count(*) |
+----------+
| 17989991 |
+----------+
1 row in set (18.65 sec)
mysql> flush table t1 for export;
--------------
flush table t1 for export
--------------
Query OK, 0 rows affected (0.00 sec)
2.在源端scp数据
[root@mysql57 testdb]# scp t1.ibd 192.168.56.88:/data/testdb
The authenticity of host '192.168.56.88 (192.168.56.88)' can't be established.
ECDSA key fingerprint is SHA256:kbb/xaKinLr3YzSaqvkSuYr2x4MgX50QhnIPvZH6bcI.
ECDSA key fingerprint is MD5:67:a9:14:9d:8c:8b:35:8c:48:65:eb:ea:61:20:7b:92.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.56.88' (ECDSA) to the list of known hosts.
root@192.168.56.88's password:
t1.ibd 100% 964MB 29.1MB/s 00:33
[root@mysql57 testdb]# scp t1.cfg 192.168.56.88:/data/testdb
root@192.168.56.88's password:
t1.cfg 100% 504 173.9KB/s 00:00
3.目标端创建t1表
mysql> create table t1 (id int,name varchar(10));
Query OK, 0 rows affected (0.03 sec)
mysql> ALTER TABLE t1 discard tablespace;
Query OK, 0 rows affected (0.02 sec)
[root@mysql8 testdb]# chown mysql.mysql t1.*
4.然后回到原数据库执行解释操作,再查看,已经没有 flush_test.cfg文件了,所以一定确定scp完了后再解锁:
mysql> unlock tables;
--------------
unlock tables
--------------
Query OK, 0 rows affected (0.00 sec)
5.查看cfg文件是否已经没有了
[root@mysql57 testdb]# ll t1*
-rw-r----- 1 mysql mysql 8586 Dec 4 14:36 t1.frm
-rw-r----- 1 mysql mysql 1010827264 Dec 4 14:36 t1.ibd
6.目的库执行导入表空间命令,然后查看表数据
ALTER TABLE t1 IMPORT TABLESPACE;
版权声明:本文为博主原创文章,未经博主允许不得转载。
MYSQL