且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在MySQL中将表从一个数据库移动到另一个数据库

更新时间:2022-12-09 15:36:36

ALTER TABLE ..可用于将表从一个数据库移动到另一个数据库:

ALTER TABLE .. can be used to move tables from one database to another :

alter table my_old_db.mytable rename my_new_db.mytable


警告:按照您的要求,这是对新数据库的迁移,而不是复制
但是您将保留表数据(如果适用于您的情况,则不保留完整性约束)


Warning : as you asked, this is a move, not a copy to the new database!
But you will keep table data (and not integrity constraints if they apply in your case)

关于php,php能够运行sql命令,因此不会有问题(如果您愿意,我可以更精确地说明问题).

Regarding php, php is able to run sql commands so it won't be a problem (i can be more precise if you wish).