Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MySQL backup on Windows

Status
Not open for further replies.

rrsub

MIS
Oct 23, 2002
536
US
I wrote this to perform nightly backups on a windows server. Just put in a .BAT file and schedule it whenever.

It works well for me on a couple of MS servers. If anyone can make modifications, please post back.

-------------------------------------------------------------
REM MySQL backup script

REM Enter the path to where you want the backup data to go
set backupdir=E:\SQLData\MySQLbackup

REM Enter the path to your MySQL binaries (where mysqldump is)
set dump=E:\MYSQL\bin

if exist %backupdir%\*8.sql del %backupdir%\*_8.sql
if exist %backupdir%\*7.sql ren %backupdir%\*_7.sql* *_8.sql
if exist %backupdir%\*6.sql ren %backupdir%\*_6.sql* *_7.sql
if exist %backupdir%\*5.sql ren %backupdir%\*_5.sql* *_6.sql
if exist %backupdir%\*4.sql ren %backupdir%\*_4.sql* *_5.sql
if exist %backupdir%\*3.sql ren %backupdir%\*_3.sql* *_4.sql
if exist %backupdir%\*2.sql ren %backupdir%\*_2.sql* *_3.sql
if exist %backupdir%\*1.sql ren %backupdir%\*_1.sql* *_2.sql


%dump%\mysqldump --all-databases > %backupdir%\mysqlbackup_1.sql
 
I wonder if you could pipe through a zip or gzip routine to compress the backup ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top