# Creating Duplicate MySQL Database

**URL:** <https://www.ruby-forum.com/t/creating-duplicate-mysql-database/62876>\
**Category:** Ruby\
**Created:** [June 8, 2006, 11:45pm UTC](https://www.ruby-forum.com/t/creating-duplicate-mysql-database/62876 "2006-06-08T23:45:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/958977/32.png) [@chris](https://www.ruby-forum.com/u/chris)\
**Post date:** [June 8, 2006, 11:45pm UTC](https://www.ruby-forum.com/t/creating-duplicate-mysql-database/62876/1 "2006-06-08T23:45:27Z")

</div>

I’ve done it once before and cannot find the command to do it.

I’m looking for a SQL command which will spit out the sql statements to  
create an existing database. All its tables and everything. So I can  
then take that code and create another database with a different name,  
but which is basically a mirror image of the original, minus the data.

Thanks in advance,  
Chris

---

<div class="post-metadata">

**Author:** ![chris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/958977/32.png) [@chris](https://www.ruby-forum.com/u/chris)\
**Post date:** [June 8, 2006, 11:59pm UTC](https://www.ruby-forum.com/t/creating-duplicate-mysql-database/62876/2 "2006-06-08T23:59:22Z")

</div>

On 6/8/06, Chris [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’ve done it once before and cannot find the command to do it.
> 
> I’m looking for a SQL command which will spit out the sql statements to  
> create an existing database. All its tables and everything. So I can  
> then take that code and create another database with a different name,  
> but which is basically a mirror image of the original, minus the data.

I believe you are looking for the mysqldump command. It isn’t sql but  
it  
outputs the sql to construct a database. (mysqldump -u=user -p=password  
app\_development)

Sean C.

---

<div class="post-metadata">

**Author:** ![chris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/958977/32.png) [@chris](https://www.ruby-forum.com/u/chris)\
**Post date:** [June 9, 2006, 2:08am UTC](https://www.ruby-forum.com/t/creating-duplicate-mysql-database/62876/3 "2006-06-09T02:08:12Z")

</div>

somehting along these lines:

mysqldump -u -p \> backup.sql  
mysql -u -p \<new\_database\> \< backup.sql
