Jump to content

mysql dump batch file stopped working.


Recommended Posts

Posted

Hello,

I had someone make a batch file for me that would backup mysql db and

recently it stopped working and I don't know the cause and how to fix it.

The bat file has not changed so it must have been a system change.

 

The error I get is right after the dump code and it says

The system cannot find the path specified. As I mentioned I can't remember

editing the batch file and the path definitely exists cine I can manually

navigate to the directory in the command prompt.

 

REM @echo off

 

for /f "tokens=1" %%i in ('date /t') do set DATE_DOW=%%i

 

for /f "tokens=2" %%i in ('date /t') do set DATE_DAY=%%i

for /f %%i in ('echo %date_day:/=-%') do set DATE_DAY=%%i

for /f %%i in ('time /t') do set DATE_TIME=%%i

for /f %%i in ('echo %date_time::=-%') do set DATE_TIME=%%i

"C:\Program Files\MySQL\MySQL Server 4.1\bin\mysqldump" -u

theusername -p"thepassword" thedbname >"D:\database

backups\thefolder\"%DATE_DAY%_%DATE_TIME%_thedbname.sql

 

Thanks

  • Replies 4
  • Created
  • Last Reply

Popular Days

Guest Pegasus \(MVP\)
Posted

Re: mysql dump batch file stopped working.

 

 

"Rob" <Rob@nospam.com> wrote in message

news:u9KkFyxjIHA.1188@TK2MSFTNGP04.phx.gbl...

> Hello,

> I had someone make a batch file for me that would backup mysql db and

> recently it stopped working and I don't know the cause and how to fix it.

> The bat file has not changed so it must have been a system change.

>

> The error I get is right after the dump code and it says

> The system cannot find the path specified. As I mentioned I can't remember

> editing the batch file and the path definitely exists cine I can manually

> navigate to the directory in the command prompt.

>

> REM @echo off

>

> for /f "tokens=1" %%i in ('date /t') do set DATE_DOW=%%i

>

> for /f "tokens=2" %%i in ('date /t') do set DATE_DAY=%%i

> for /f %%i in ('echo %date_day:/=-%') do set DATE_DAY=%%i

> for /f %%i in ('time /t') do set DATE_TIME=%%i

> for /f %%i in ('echo %date_time::=-%') do set DATE_TIME=%%i

> "C:\Program Files\MySQL\MySQL Server 4.1\bin\mysqldump" -u

> theusername -p"thepassword" thedbname >"D:\database

> backups\thefolder\"%DATE_DAY%_%DATE_TIME%_thedbname.sql

>

> Thanks

>

 

There are two path references in the script and you must check

both of them:

C:\Program Files\MySQL\MySQL Server 4.1\bin

and

D:\database backups\thefolder

 

To make the script more robust, you should add this line right

att the start:

@echo off

if not exist "D:\database backups\thefolder" md "D:\database

backups\thefolder"

Posted

Re: mysql dump batch file stopped working.

 

I added that line like you suggested even though I'm positive both

directories exist. I still receive the same error.

Guest Pegasus \(MVP\)
Posted

Re: mysql dump batch file stopped working.

 

 

"Rob" <me@nospam.com> wrote in message

news:%23UE%23q24jIHA.3400@TK2MSFTNGP03.phx.gbl...

>I added that line like you suggested even though I'm positive both

>directories exist. I still receive the same error.

 

Create a new batch file like so:

1. @echo off

2. for /f "tokens=1" %%i in ('date /t') do set DATE_DOW=%%i

3. for /f "tokens=2" %%i in ('date /t') do set DATE_DAY=%%i

4. for /f %%i in ('echo %date_day:/=-%') do set DATE_DAY=%%i

5. for /f %%i in ('time /t') do set DATE_TIME=%%i

6. for /f %%i in ('echo %date_time::=-%') do set DATE_TIME=%%i

7. dir "C:\Program Files\MySQL\MySQL Server 4.1\bin\mysqldump" >

c:\test.txt

8. echo D:\database backups\thefolder\"%DATE_DAY%_%DATE_TIME%_thedbname.sql

>> c:\test.txt

9. dir "D:\database

backups\thefolder\"%DATE_DAY%_%DATE_TIME%_thedbname.sql" >> c:\test.txt

10. dir "D:\databasebackups\thefolder\"%DATE_DAY%_%DATE_TIME%_thedbname.sql"

>> c:\test.txt

11. notepad c:\test.txt

12. "C:\Program Files\MySQL\MySQL Server 4.1\bin\mysqldump" -u

theusername -p"thepassword" thedbname >"D:\database backups\thefolder\"%

DATE_DAY%_%DATE_TIME%_thedbname.sql

 

You must, of course, remove the line numbers. Their purpose is to

mark the start of each line. Note that Line 12 is a very long line.

Is there a space between "database" and "backups"?

 

Post the contents of c:\test.txt when it appears on your screen.

Posted

Re: mysql dump batch file stopped working.

 

Volume in drive C is 1

Volume Serial Number is 3C91-1527

 

Directory of C:\Program Files\MySQL\MySQL Server 4.1\bin


×
×
  • Create New...