这里提供一个变通的方法。
1. 创建出新库名:
代码如下:
mysql>create database db_v2;
2.生成rename语句,从olddb里迁移,我这里olddb里sbtest;
代码如下:
mysql>select concat("rename table ",table_schema,".",table_name," to db_v2.",table_name,";") into outfile '/tmp/rename_to_db_v2.sql' from information_schema.tables where table_schema='sbtest';
3.执行生成的sql
代码如下:
mysql>source /tmp/rename_to_db_v2.sql
就这么简单可以搞定了。
Good luck!