MySQL移动、重新命名数据表的方法

转载

原文地址:http://www.111cn.net/database/mysql/51261.htm

MySQL 的 Table 要搬到另外一个 DB、Table 重新命名、两个 Table 要互换名字 等, 要怎么做?


MySQL 搬移、重新命名 Table 的方法

命令全部都使用 RENAME 就可以达成,


MySQL Table 从 db_a 要搬到 db_b

 代码如下 复制代码

RENAME TABLE db_a.old_table TO db_b.new_table;

MySQL Table 改名字(重新命名)

 代码如下 复制代码

RENAME TABLE old_table TO new_table;

MySQL 两个 Table 要互换名字

 代码如下 复制代码

RENAME TABLE old_table TO tmp_table,
new_table TO old_table,
tmp_table TO new_table;

posted @ 2015-08-01 13:25  远洪  阅读(413)  评论(0)    收藏  举报