database - Automatic MySQL backup using batch File -
i trying make auto backup of mysql database; searched many links got many references didn't find single option work me(accept paid software). trying link.
now have batch script(below given) , edit according credentials creating empty sql file. don't know why? new mysql , it's auto backup mechanism poor.
@echo off set timestamp=%date:~10,4%%date:~4,2%%date:~7,2% rem export databases file c:\path\backup\databases.[year][month][day].sql "c:\wamp\bin\mysql\mysql5.6.12\bin\mysqldump.exe" –-user=root –-password=xyz --all-databases --result-file="d:\dbbackup.%timestamp%.sql" rem change working directory location of db dump file. c: cd \path-to\backup\ rem compress db dump file cab file (use "expand file.cab" decompress). makecab "databases.%timestamp%.sql" "databases.%timestamp%.sql.cab" rem delete uncompressed db dump file. del /q /f "databases.%timestamp%.sql"
i run batch file create backup empty sql file.
for future reference , going update answer! update below batch file according configuration:
echo off start "" "c:\wamp\bin\mysql\mysql5.6.12\bin\mysqldump.exe(your mysqldump address)" --user root --password=(provide here) databasenamehere --result-file="d:\where want path sqlfilename.sql" --database databasenamehere
you can use
.%date:~10,4%-%date:~7,2%-%date:~4,2% blockquote
in backup file name store date in file name.
then run batch file regularly using windows task schedule.
Comments
Post a Comment