复制Mysql数据库的数据库结构 [英] Copy Database Structure of Mysql Database
本文介绍了复制Mysql数据库的数据库结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用MySql 5.1数据库.
I am using MySql 5.1 Database.
我已经创建了一个Project数据库. (模板数据库)
I have created a Project database. (Template Database)
,并且每次用户创建新项目时都想从应用程序中创建同一数据库的副本.
and want to Create a copy of the same database from the Application, every time, User Creates A new Project.
如何复制和创建具有相同结构的新数据库?
How can I copy and Create a New Database of same structure?
命令是什么?
推荐答案
如果仅要将表结构等从一个数据库复制到另一个数据库,则可以使用以下单个bash行:
If you only want to copy the table structure etc. from one db to the other you can use this single bash line:
mysqldump -u user -ppass -d olddb | mysql -u user -ppass -Dnewdb
新数据库必须已经存在. mysqldump命令中的-d标志可防止复制数据.
The new database must exist already. The -d flag in the mysqldump command prevents copying of data.
这篇关于复制Mysql数据库的数据库结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文