By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,044 Members | 1,287 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,044 IT Pros & Developers. It's quick & easy.

mysqldump not working in my batch file

P: 3
I have my database stored with root user and a blank password
I want to schedule a regular backup of my database thus using batch file to create one.
My batch file goes like this
c:\xampp\mysql\bin>mysqldump -u root -p sampledb > e:\backup\backup.%date:~1
0,4%%date:~7,2%%date:~4,2%.sql
This command is working absolutely fine in CMD.
But after putting it in .bat a backup.date file is created at destination.
Further more file type is of DATE and size is Zero.
Please help me out in creating a batch file.
I have seen some of the discussions where it was suggested to put my mysqldump path into double quotes. I have tried this but got nothing else than a vain.
How should I enter my password as blank.
May 1 '14 #1
Share this Question
Share on Google+
4 Replies


Expert 100+
P: 1,035
Leave out the '-p'.

Because you do not have a password, it makes no sense asking for one..... ;-)
May 1 '14 #2

P: 3
Thanx it has sovled one part of my query...
May 3 '14 #3

P: 3
set hr=%time:~0,2%
if "%hr:~0,1%" equ " " set hr=0%hr:~1,1%
C:\xampp\mysql\bin\mysqldump.exe --databases sampledb --user=root --ignore-table=or.oporeal_controlpanel > e:\backup\backup_%date:~-4,4%%date:~-10,2%%date:~-7,2%_%hr%%time:~3,2%%time:~6,2%.sql

This is the command which has worked for me.
This is for all others who may face this kind of problem.
May 3 '14 #4

Expert 100+
P: 1,035
a little warning about this:
It does not work if your date setting differs from that of guptaujjawal
Expand|Select|Wrap|Line Numbers
  1. C:\Users\Luuk>echo %DATE%
  2. zo 04-05-2014
My date setting is "dd-mm-yyyy"
May 4 '14 #5

Post your reply

Sign in to post your reply or Sign up for a free account.