1

I want to run a dos script to execute the following command:

C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqldump --opt --where='1 limit 1'  -h a.b.c.d  -u root -proot remotedb remotetable|mysql -u root -pcanada localdb

I am not able to run this script.If I do not put double quotes around the path it gives error as 'C:\Program' is not recognized as an internal or external command. If I put double quotes around the path then also it fails with following error: "mysqldump: Got error: 1049: Unknown database 'limit' when selecting the database"

Could anyone suggest how I could run this query in script.It runs perfect when i run it directly through command line.Problem comes when i try to run it through batch ie .cmd file. Thanks in advance:)

1 Answer 1

1

Try

"C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqldump" --opt --where="1 limit 1" -h a.b.c.d -u root -proot remotedb remotetable

You have to quote the path because it contains spaces and cmd doesn't treat single quotes as anything special.

Sign up to request clarification or add additional context in comments.

1 Comment

actually i also added double quote after mysqldump then it worked:"C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqldump" --opt --where="1 limit 1" -h 54.241.136.44 -u root -proot salebuild_ctl autoconfirm|mysql -u root -pcanada salebuild_ctl

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.