Tuesday, January 7, 2014

Automated backup of mySql database

To make back up mysql database automatically,we may use task scheduler(for windows) or cron for linux server.

at winodws, we can execute a batch file using task scheduler. The content for batch file is:
--
@echo off
echo Running Rsa dump...
-h -u -p --result-file=
echo Done!

--


for my case the batch file was:
--
@echo off
echo Running Rsa dump...
G:\BACK_UP_Database\mysqldump\newer\mysqldump -h 10.76.12.51 -uroot -p*paul*db# --result-file="G:\BACK_UP_Database\RSA\backup_%DATE%.sql" rsadb
echo Done!
--

it should be noticeable that the user and password is stick to the -u and -p parameter. If we provide space among them then password will be prompt for to input.

The short date format should not contain slash. It causes problem to create file with that name. we may set the short date format as yyyy-MMM-dd .

After that we will have to configure the task manager according to our requirements.

No comments: