1.0 INTRODUCTION
Backing up a database is a very important step every administrator has to every day. Now as smart administrator would want to find a way to do it every night without ever having to worry about being there or trusting someone else doing it for them. That is where crontab’s come into play. The crontab will run when it is commanded to.
The other issue that needs to be addressed is backing up the server while it is live. The hotcopy command will do take care of this conundrum very nicely.
2.0 PROJECT
I. Requirements
• Linux VM Machine
• Root access
• MySQL Database
II. Installation
The Crontab
• Firstly we need to edit the crontab file. Enter a terminal with root access.
• Type crontab –e. This is going to be an empty file unless you have already set up some crontabs.
• This area split up into sections.
• | min | hour | day/month | month(6,12) | day/week(1 – 5) | execution time |
• Type this line in the crontab and save
• 0 23 * * 1, 3, 5 mysqldump -u backup -p password > /backup/filename.sql
• That’s it. Every evening at 11:00 pm the database will save.
Hotcopy
• This is an easy little command.
• mysqlhotcopy -u backup -p password dbname /backup/mysql
3.0 SUMMARY
As you can see these two easy steps will make your life as a MySQL database administrator that much easier. More time to work on you tan.