# Trouble with mysqldump

**URL:** <https://www.ruby-forum.com/t/trouble-with-mysqldump/192893>\
**Category:** Ruby\
**Created:** [August 7, 2010, 8:45pm UTC](https://www.ruby-forum.com/t/trouble-with-mysqldump/192893 "2010-08-07T20:45:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [August 7, 2010, 8:45pm UTC](https://www.ruby-forum.com/t/trouble-with-mysqldump/192893/1 "2010-08-07T20:45:52Z")

</div>

when i try  
program=“C:\Program Files\MySQL\MySQL Server 5.1\bin  
\mysqldump.exe”  
irb(main):008:0\> system(program)  
Usage: mysqldump [OPTIONS] database [tables]  
OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3…]  
OR mysqldump [OPTIONS] --all-databases [OPTIONS]

it works and is able to launch myssqldump.exe  
so i want to setup a backup process using ruby.  
however the next step does not work. dont know why?

destination=“e:\tradingtools\databackup\#{dt}.sql”  
system("#{program} --user=root --password=password dbtrader

> #{destination}")

error that i get is  
‘C:\Program’ is not recognized as an internal or external command,  
operable program or batch file.

---

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [August 7, 2010, 8:59pm UTC](https://www.ruby-forum.com/t/trouble-with-mysqldump/192893/2 "2010-08-07T20:59:55Z")

</div>

On Sat, Aug 7, 2010 at 11:45 AM, Junkone [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> destination=“e:\tradingtools\databackup\#{dt}.sql”  
> system("#{program} --user=root --password=password dbtrader
> 
> > #{destination}")
> 
> error that i get is  
> ‘C:\Program’ is not recognized as an internal or external command,  
> operable program or batch file.

You’ll need to wrap the program name in quotes to use it with arguments  
like  
that. Try instead:  
system(“"#{program}" --user=root --password=password dbtrader \>  
"#{destination}"”)

Ideally you would pass each argument to system as a separate argument,  
like:  
system(program,“–user=root”,“–password=password”, etc)  
But I don’t know how to pipe the output of this to a file… perhaps  
someone  
else on the list can help.

-Jonathan N.
