复制数据库结构的Mysql数据库 [英] Copy Database Sructure of Mysql Database
问题描述
我已经创建了一个Project数据库。 (Temnplate Database)
并希望从应用程序创建相同数据库的副本,每次用户创建一个新的项目。
如何复制和创建相同结构的新数据库?
这是什么命令?
感谢您的帮助。
如果您只想复制表结构等从一个db到另一个可以使用这个单一的bash行:
mysqldump -u user -ppass -d olddb | mysql -u user -ppass -Dnewdb
新数据库必须已经存在。 mysqldump命令中的-d标志可以防止复制数据。
I am using MySql 5.1 Database.
I have created a Project database. (Temnplate 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.??
What is the Command to do so???
Thanks a Lot for Help.
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
The new database must exist already. The -d flag in the mysqldump command prevents copying of data.
这篇关于复制数据库结构的Mysql数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!