# Database dump from application

**URL:** <https://www.ruby-forum.com/t/database-dump-from-application/147130>\
**Category:** Rails\
**Created:** [August 28, 2008, 5:58pm UTC](https://www.ruby-forum.com/t/database-dump-from-application/147130 "2008-08-28T17:58:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a698b9/32.png) [@marco](https://www.ruby-forum.com/u/marco)\
**Post date:** [August 28, 2008, 5:58pm UTC](https://www.ruby-forum.com/t/database-dump-from-application/147130/1 "2008-08-28T17:58:38Z")

</div>

hello,  
i am new to rails and would like to know if there is a simple way to  
dump my database (schema and data) from within my rails app.

thanks  
marco

---

<div class="post-metadata">

**Author:** ![marco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a698b9/32.png) [@marco](https://www.ruby-forum.com/u/marco)\
**Post date:** [August 29, 2008, 8:20am UTC](https://www.ruby-forum.com/t/database-dump-from-application/147130/2 "2008-08-29T08:20:29Z")

</div>

marco wrote:

> hello,  
> i am new to rails and would like to know if there is a simple way to  
> dump my database (schema and data) from within my rails app.
> 
> thanks  
> marco

try running  
rake --tasks  
and see if anything there looks useful.  
Cheers.  
-=R

---

<div class="post-metadata">

**Author:** ![marco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a698b9/32.png) [@marco](https://www.ruby-forum.com/u/marco)\
**Post date:** [September 23, 2008, 3:51pm UTC](https://www.ruby-forum.com/t/database-dump-from-application/147130/3 "2008-09-23T15:51:49Z")

</div>

thanks for that answer, but that was not what I was looking for.

I would like to dump my database from within my application (a link in  
the app “Save Database To File”), not from the commandline.  
Or is there a possibility to invoke a commandline?

marco

On 29 Aug., 08:20, Roger P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![marco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a698b9/32.png) [@marco](https://www.ruby-forum.com/u/marco)\
**Post date:** [September 23, 2008, 8:30pm UTC](https://www.ruby-forum.com/t/database-dump-from-application/147130/4 "2008-09-23T20:30:05Z")

</div>

marco wrote:

> thanks for that answer, but that was not what I was looking for.
> 
> I would like to dump my database from within my application (a link in  
> the app “Save Database To File”), not from the commandline.  
> Or is there a possibility to invoke a commandline?  
> Yeah command line is probably an ok route:

dumped\_db\_as\_string = `mysqldump -uroot -ppassword db_name`
