I have a MySQL database and I need to be able to back it up and restore it and would like to do this using Cron jobs.
My Back up Cron job is backing up to the selected directory but as a 0kb file
Here is my daily backup job:
mysqldump --opt -u userid -p password -h SQLHOSTNAME DATABASENAME > /home/username/Backup/DB.sql.
This is my restore job:
mysql -u userid -p password -h SQLHOSTNAME DATABASENAME < /home/username/Backup/DB.sql
I plan to manually enter the filename should I have to restore and run it as a cron job.
I’m assuming I would have to stop to DB first before a restore. - haven’t reached this stage yet as the backup keeps failing.
Any help with this would make me a very very happy noob