Is there a way to back up MySQL database automatically at certain times of the day for designated servers or send an email with an attachment.. Which ever do you think is the best and safest way to achieve this?
Best way to do this would be
mysqldump.exe --user=YourUserName --password=YourPassword --host=localhost --port=3306 --result-file="Path\dump.sql" --databases "DatabaseName1" "Database2"
mysqldump.exe --user=root --password=root --host=localhost --port=3306 --result-file="c:\www\db\backup.%date:~10,4%%date:~7,2%%date:~4,2%.sql" --default-character-set=utf8 --single-transaction=TRUE --databases "dbtest1" "dbtest2"
The pattern backup.%date:~10,4%%date:~7,2%%date:~4,2%.sql
will create a unique name (backup20131010.sql
) each time it will run
Now you just need to call this command in your task scheduler. That's it. :)