7

I have WampServer 2.0 that is installed on Windows on my laptop.

I'm running on it an application that I wrote. The application is working with MySQL database.

I would like to make backups of this database periodically.

How this can be done ?

How could I define cron on Windows ?

2

3 Answers 3

12

The rough equivalent of crontab -e for Windows is the at command, as in:

at 22:00 /every:M,T,W,Th,F C:\path\to\mysql\bin\mysqldump.exe ...

Running the at command by itself lists the tasks you've created using at.

The mysqldump documentation is here.

Sign up to request clarification or add additional context in comments.

2 Comments

I agree with Ruel. 'at' is a very neat app I never knew existed! Got a +1 from me too. It would be an even better answer if you gave a full example rather than the '...'. After I figure it out I'll update your answer. ;)
FYI, while trying to running 'at' on Windows with cygwin, it told me that it was deprecated and to use schtasks.exe instead
8

The most popular way to backup MySQL database is to use mysqldump:

  1. Open a Windows command line.

  2. Specify the directory to mysqldump utility

    cd "C:\Program Files\MySQL\MySQL Server 5.7\bin"

  3. Create a dump of your MySQL database.

mysqldump.exe --user=YourUserName --password=YourPassword --host=localhost --port=3306 --result-file="Pathdump.sql" --databases "DatabaseName"

Also, there are a lot of third-party tools, which can perform MySQL backups automatically on a regular basis.

Comments

0

You could use a bash script.

#!/bin/sh
mysqldump -uroot -ppwd --opt db1 > /sqldata/db1.sql
mysqldump -uroot -ppwd --opt db2 > /sqldata/db2.sql

cd /sqldata/
tar -zcvf sqldata.tgz *.sql
cd /scripts/
perl emailsql.pl

http://paulbradley.tv/38/

3 Comments

-1 He just mentioned, he's on windows. The word Windows was mentioned 4 times including in the tag.
Cygwin is not installed on Windows by default.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.