MySQL 将表从一个架构移动到另一个架构?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5910261/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 19:47:40  来源:igfitidea点击:

move table from one schema to another schema ?

mysqldatabase

提问by p27

I want to move table from one schema to another schema in mysql , can anybody tell me how can I do this .

我想将表从一个模式移动到 mysql 中的另一个模式,谁能告诉我我该怎么做。

回答by Harry Joy

If both schema is on same server then Alter table can be used to move tables from one db to another.

如果两个架构都在同一台服务器上,则可以使用 Alter table 将表从一个数据库移动到另一个数据库。

alter table old_db.fooTable rename new_db.fooTable

回答by Kruti Mehta

Moving tables with space characters in between should be enclosed.

移动表格之间的空格字符应封闭。

Example:

例子:

ALTER TABLE `schema1`.`tbl somename` 
RENAME TO  `schema2`.`tbl somename` ;