I need to make a backup of database everyday at 10

+3 votes
I need to make a backup of my database everyday at 10. I setup the cron job and i get an error that says Access Denied for user ...@localhost.
asked Jan 24, 2015 in Shared Hosting by Lerato

2 Answers

0 votes

Assuming this is mysql, you should create a mysql user specifically to perform the backup task, and then be sure to pass the credentials when you use that user.  e.g. something like this:

2 10 * * *  mysqldump -u'domusernm_mysqluser' -p'thatawfulpassword' domusernm_dbname table1 table2 table3 > $HOME/10AMbackup.sql

answered Jan 26, 2015 by Bananaman (5,390 points)
0 votes
It is also a good idea to have an offsite backup of your data that you store regularly in case of any data corruption, so make sure that once you have made a dump of your database you pull that data onto a secure drive that you store safely for disaster recovery.
answered Jan 26, 2015 by AfriMan (14,640 points)