完了后利用 rename table old_table to new_table
语句来批量更改表名到新库:
(debian-ytt1:3500)|(yttdb_new)>set group_concat_max_len = 18446744073709551615;
Query OK, 0 rows affected (0.00 sec)
(debian-ytt1:3500)|(yttdb_new)>SELECT CONCAT('rename table ',
GROUP_CONCAT(CONCAT(' yttdb_old.',table_name,' to yttdb_new.',table_name)) )
FROM information_schema.TABLES
WHERE table_schema = 'yttdb_old' AND table_type = 1 INTO @rename_lists;
Query OK, 1 row affected (0.01 sec)
(debian-ytt1:3500)|(yttdb_new)>prepare s1 from @rename_lists;
Query OK, 0 rows affected (0.00 sec)
Statement prepared
(debian-ytt1:3500)|(yttdb_new)>execute s1;
Query OK, 0 rows affected (55.41 sec)
(debian-ytt1:3500)|(yttdb_new)>drop prepare s1;
Query OK, 0 rows affected (00.01 sec)