Friday 21 August 2009

MySql Backups

There appears to be a few different ways to do this. One of the most desirable ways appears to be via MySQL administrator but this appears to be only active for enterprise users.

There a few discussed on both the MySQL site and devshed. The most popular option seems to be to use command line with mysql dump.

I've adapted this shell comand to store a backup copy
"C:\Program Files\MySQL\MySQL Server 7.0\bin\mysqldump" -u root -p sugarcrm_dbo > "C:\Documents and Settings\SOME DIR\mysqlweekly.sql"
and
"C:\Program Files\MySQL\MySQL Server 7.0\bin\mysqldump" -u root -p sugarcrm_dbo > "C:\Documents and Settings\SOME DIR\mysqldaily.sql"

My reasoning for two files is that I think it pheasible that the DB could get corrupted during an update, killing both the DB and the backup.

Problem with doing this is you need to store the password in the bat file to fully automate and that is pretty insecure. Further investigating will need to be done before going ahead in this manor.

I then store these two bat files and then need only use windows scheduled tasks. To open Scheduled Tasks, click Start, click All Programs, point to Accessories, point to System Tools, and then click Scheduled Tasks. Then simply follow the add wizard.

For debug purposes of the bat file use: cmd.exe /k "the .bat file" so that the window stays open, allowing viewing of any errors.

UPDATE: I appear to be wrong, you can update using public MySQL administrator. You simply need to create the project 1st. Note, to run as scheduled tasks it needs to be done via a stored connection within the connections manager. Why this didn't come up in a search on google or be updated on the MySQL site is beyond me. Retweet this button on every post blogger

No comments:

Post a Comment

 
Bookmark and Share