在MySQL中将表从一个数据库移动到另一个数据库 [英] Move table from one database to another in MySQL

查看:1791
本文介绍了在MySQL中将表从一个数据库移动到另一个数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不使用phpMyAdmin的情况下将表从一个数据库移动到另一个数据库?如果可以的话,PHP会更好.

How to move a table from one Database to another Database without using phpMyAdmin? It will be better if it is possible by PHP.

推荐答案

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).

这篇关于在MySQL中将表从一个数据库移动到另一个数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆