2010-12-30, 01:01
czfj5r Wrote:Hi,
I have used this little trick to do backup of the database. Perhaps it can help. Windows related though...
1. Open Notepad
2. Add the following to the file:
"C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqldump.exe" --user=xbmc --password=xbmc --add-drop-table --all-databases --result-file=C:\Temp\backup-%DATE%.sql --dump-date
3. Save the file with a .cmd at the end, as example "MySQLBackup.cmd"
4. Go to control panel / schedule task / add new task
5. When asked for the program to run, browse to your newly created file and choose it. Then continue the wizard and choose the options you want (daily, weekly, ...)
Done.
In the commandtext above you need to be aware of the following:
- adjust the path to the mysqldump.exe if needed
- Insert your user and password (I used xbmc as example above)
- I have a %DATE% in the filename above, please be aware that if you use "/" as date seperator it will not work as that is not allowed in teh filename so change your regional settings to use "-" as date seperator
- after the --result-file= you can add the place you want the backup to be put (as example onto another share, usb-stick or...)
I also saw you wanted to remove things automatically after some time. I found the following commandline item you can try to add to the file. I have NOT tested it but feel free
forfiles /p C:\Temp\ /m backup-*.* /d -7 /c "cmd /c del @path"
This command should remove files older then 7 days so just change the 7 to whatever you need. As said, not tested yet...
Hope it helps. You also do not have to add any other program as mysqldump comes with the MySQL installation
This is exactly what i was looking for, Thank You