mysql migration methodology in various examples
mariadb official website Reference Description:
https://mariadb.com/kb/en/innodb-file-per-table-tablespaces/#copying-transportable-tablespaces
Demand Description: mysql migration between different data tables
Source database: 192.168.142.238 dbserver.tbl_name
target database: 192.168.142.239 db239.tbl_name
Step: 192.168 . 142 .238 lock table the root @ MariaDB0 18 is : 40 : [ DbServer ] > the FLUSH TABLES tbl_name the FOR the EXPORT; Query the OK, 0 rows affected ( 0.047 sec) # data copy [ the root @ db238 DbServer ] LL tbl_name #. * - RW - RW - - 1203-Mar. 1 MySQL MySQL tbl_name.frm 13 is 17:23 - RW - RW - - 41.94304 million MySQL MySQL-Mar. 1 17:24 13 is tbl_name.ibd [root@db238 dbserver]# cp tbl_name.ibd /tmp/ # 192.168.142.238解锁 root@MariaDB0 18:41: [dbserver]> UNLOCK TABLES; Query OK, 0 rows affected (0.041 sec) 第二步:192.168.142.239 root@MariaDB0 18:44: [db239]> CREATE TABLE `tbl_name` ( `uid` int(11) NOT NULL, `total` int(11) DEFAULT NULL, `rankTitle` varchar(50) DEFAULT NULL, `perct` decimal(3,1) DEFAULT NULL, PRIMARY KEY (`uid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; root@MariaDB0 18:44: [db239]> The ALTER TABLE tbl_name the DISCARD TABLESPACE; # data from the source data to the destination server machine corresponding directory [ the root @ db238 tmp ] # SCP / tmp / tbl_name.ibd the root @ 192 . 168.142 . 239 : / Data / MySQL / Data / db239 / [ the root @ ES-VM-01 db239 ] # chown mysql.mysql tbl_name.ibd the root @ MariaDB0 18 is : 44 is : [ db239 ] > the ALTER TABLE tbl_name IMPORT TABLESPACE; Query the OK, 0 rows affected, 1 warning (0.237 sec) root@MariaDB0 18:46: [db239]> select * from tbl_name limit 1; +-----+-------+--------------------+-------+ | uid | total | rankTitle | perct | +-----+-------+--------------------+-------+ | 0 | 10000 | 宇宙好大学 | 1.0 | +-----+-------+--------------------+-------+ 1 row in set (0.002 sec) root@MariaDB0 18:47: [db239]>