Auto backup MySql database in windows with cloud

UPDATED: 16 March 2013
Its more important for developer and database admin to preserve data than codding. On a system crash you can code your software again but its hard to get bunch of data available in your database. My system crashed 2 times because of Hard disk error but thanks to cloud saving my ass. If you are new to cloud let me explain you what is cloud and importance of cloud.

Cloud Computing
Cloud Computing is an evolutionary milestone of Internet for your important data. Cloud sync your data from desktop, laptop, tablet, mobile to Internet and vise-versa. When you create file on a local system's cloud folder it'll upload it over Internet ASAP. So if your system crash the next morning you'll have all your important data available over internet and that may save your life.

Cloud Computing
Cloud Computing
Cloud Computing service provider
There are so many websites provides cloud computing for free with limited disk space. I listed some good website below. Create your account and folder on local computer.

Note: Don't create cloud folder on C: drive. Sometime only OS of system crash so it may wipe out your cloud folder on re-installation. If your cloud folder contains data of 1GB or more then it'll download all data again so better to just re-install cloud software and point it to old folder.

Creating backup of MySql to cloud folder

Step 1 : Download the javaQuery API [javaQuery Autobackup.bat] from

Step 2 : Copy javaQuery Autobackup.bat in cloud folder say "cloud\database\autobackup program\". Edit file by right click on it > edit. Check out the code snippet of file.
:: MySql auto backup program by
:: Its a part of javaQueryAPI
:: Follow us on G+: ; Facebook: ; twitter:
:: This program wrote for those who work on local machine database. This will take backup with less options. If you are working with important database and want better options of backup use mysql workbench.

set year=%DATE:~10,4%
set day=%DATE:~7,2%
set mnt=%DATE:~4,2%
set hr=%TIME:~0,2%
set min=%TIME:~3,2%

IF %day% LSS 10 SET day=0%day:~1,1%
IF %mnt% LSS 10 SET mnt=0%mnt:~1,1%
IF %hr% LSS 10 SET hr=0%hr:~1,1%
IF %min% LSS 10 SET min=0%min:~1,1%

:: Don't use " in below path. Change file name as you want.
set fileName=javaQuery [Date~%day%-%mnt%-%year%;Time~%hr%-%min%].sql

:: settings for backup
:: Note: Don't use space between "=" and value; i.e : dbuser=root is correct; dbuser= root is wrong.

:: userName to login
set dbuser=root

:: password to login
set dbpass=root

:: schema to backup; If you want to backup all database use --database for dbschema
set dbschema=javaquery

:: set host ip address
set dbhost=

:: set port of host
set dbport=3306

:: folderpath for backup. Don't use " in below path
set fldr=D:\Google Drive\Workspace\Database backup\

:: MySQLdump EXE Path
set mysqldumpexe="C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqldump.exe"

%mysqldumpexe% --user=%dbuser% --password=%dbpass% --host=%dbhost% --port=%dbport% %dbschema% --routines --result-file="%fldr%%fileName%"

echo done...

:: If you find that backup file is not creating remove "::" from above line and it'll show you the execution of code.

Step 3 : You have to change the file in order to work on your local machine. I listed the data that you have to change in javaQuery Autobackup.bat file

  1. Change fileName ( Backup file name )
  2. Change dbuser ( Username to login database )
  3. Change dbpass ( Password to login database )
  4. Change dbschema ( Schema to create backup )
  5. Change dbhost ( ipAddress of host )
  6. Change dbport ( port of host )
  7. Change fldr ( Folder to store backup file )
  8. Change mysqldumpexe ( Executable file to create dump of mysql database )

Step up : If you want instant back up just run or double click the file. That will create the back up file at that time.

I created video to demonstrate how you can create the "Schedule Task" for backup.