News:

Wondering if this will always be free?  See why free is better.

Main Menu

Best Way To Backup?

Started by Paffman, June 27, 2020, 09:25:10 PM

Previous topic - Next topic

Paffman

Had a quick search and couldn't see an answer.

What is the best way to backup a forum/database?

In cpanel I am not able to download the forum folder. I am a little unsure how to use phpMyAdmin.

Please run it past me slowly :-)

Steve

Antechinus

Does your host allow cron jobs? Those are the most convenient for database backups (it's just a fancy name for a scheduled backup).

Backing up files can only be done by downloading them to off-server storage. You should be able to download files, either individually or as gzipped folders. If you can't, that suggests a problem with the host.

ETA: Added screenshot of cPanel, so you can see where cron jobs hide. :)

Paffman

Thanks for that, found it.

Is it just for Linux?

Get this warning: "Warning: You need to have a good knowledge of Linux commands before you can use cron jobs effectively. Check your script with your hosting administrator before adding a cron job."

Looks like there are PHP commands to use...

Don't know the commands to use.

Antechinus

Sounds scary, but the good news is if you get it wrong it won't kill the server. It just won't make backups for you.

mysqldump -u chief_muppet -pmybirthday db_forumstuffz | gzip > /home/muppet_show/backups/db_forumstuffz_$(date +\%Y\%m\%d).sql.gz

That will run a daily backup, date stamp it, gzip it, and stash it in a backups folder that is not web-accessible (you don't want the backups to be web-accessible, for obvious reasons).
Naturally, change "chief_muppet" to actual username and change "mybirthday" to your actual password, as well as changing "db_forumstuffz" to the real database name and "muppet_show" to your domain name.

I also run another one, which stops the backups folder overflowing by deleting any backups older than one week.

find /home/muppet_show/backups -mtime +6 -type f -delete

You can change +6 to whatever number you like, if you want to keep backups on the server for two weeks or whatever.

Advertisement: