Question

I have written a cron job for dumping my mysql database but it's not working.

Here it is.

/usr/bin/mysqldump -h localhost --user=user --password=mypass --databases dbname | gzip > /home/username/site_dir_name/uploads/backup.sql.gz

I am using cpanel.

No correct solution

OTHER TIPS

Try this

mysqldump -u{user name without space} -p{password without space} Database_name | gzip -9 > /home/backup_$(date +"\%Y.\%m.\%d.\%S.\%N").sql.gz 2> /home/db.log

add this line into cron job.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top