468,469 Members | 2,145 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,469 developers. It's quick & easy.

mysqldump not working in my batch file

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
4 2201
Luuk
1,043 Expert 1GB
Leave out the '-p'.

Because you do not have a password, it makes no sense asking for one..... ;-)
May 1 '14 #2
Thanx it has sovled one part of my query...
May 3 '14 #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
Luuk
1,043 Expert 1GB
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.

Similar topics

4 posts views Thread by Jason Shohet | last post: by
4 posts views Thread by MLH | last post: by
reply views Thread by Vijay Kumar | last post: by
3 posts views Thread by Mandragon03 | last post: by
14 posts views Thread by =?Utf-8?B?R2lkaQ==?= | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.