2022-01-24, 07:51 PM
(This post was last modified: 2022-01-24, 07:56 PM by HLFadmin. Edited 1 time in total.)
I have created a folder called database in my server space one level below public_html.
A read-only, executable script HLFdump.sh is in there, which contains
I have a cron job set up in cpanel to execute that script daily. I periodically download that backup to local filespace.
Obviously, delete old files to save space.
I use that backup to upload to a different server for migration or testing purposes.
lkop's answer is better. SSH commandline backup is most secure but requires manual initiation.
Cron job script uses stored password, which is less secure, but acceptable for my purposes because of restricted permissions on folder and script, and it is not in the public webspace.
A single backup file is easily transportable, especially for a large database. Limitations of phpMyAdmin narrow the options for restoring.
A read-only, executable script HLFdump.sh is in there, which contains
# shell script to create a mysql dump from HLF database
# create backup
mysqldump --no-tablespaces -h localhost -u db_username -pdbpassword hlf_dbname > ~/database/hlf-db-$(date +%Y-%m-%d).sql
I have a cron job set up in cpanel to execute that script daily. I periodically download that backup to local filespace.
Obviously, delete old files to save space.
I use that backup to upload to a different server for migration or testing purposes.
SSH_command_line$> mysql -h localhost -u db_username -p hlf-db-01-24-22.sql > hlf_dbname
lkop's answer is better. SSH commandline backup is most secure but requires manual initiation.
Cron job script uses stored password, which is less secure, but acceptable for my purposes because of restricted permissions on folder and script, and it is not in the public webspace.
A single backup file is easily transportable, especially for a large database. Limitations of phpMyAdmin narrow the options for restoring.