Here is a quick introduction to the cPanel backup database by cronjob from our experts. Our Server Management Support team is here to lend a hand with your queries and issues.
How to backup database in cPanel by Cronjob
Did you know that cPanel offers a cron job to run commands or scripts at specific times? This allows us to take backups at regular intervals. The database is responsible for storing the website’s critical information. Hence, taking a backup at regular intervals is extremely important. Let’s take a quick look at the steps to do this:
- First, log in to cPanel.
- Then, head to the Advanced tab and select Cron Jobs.
- After that, enter your email in the Cron email section if you want to receive an email each time the cron runs a command. Alternatively, you can choose to redirect the command’s output to prevent individual emails for each cron job done.
- Next, we have to add a new cron job and the common settings. Our experts recommend opting for once per day.
- Then, enter the following command in the command box:
mysqldump -uroot -ppassword --opt dbname > /home/mysql_backup/dbname-$( date +"\%Y_\%m_\%d" ).sql
Where we make the following changes:
- root: modify it to database user
- password: modify it to database user password
- dbname: modify it to database name
- /home/mysql_backup/: modify it to the path where the backup file is to be added.
- Finally, we have to click the Add New Cron Job button. Now, cPanel cron will take a backup of the database every day.
Restoring the database from the backup is an easy job as well. All we have to do open Backup in cPanel in the Files section. Then, head to Restore a MySQL Database Backup, and navigate to the backup file on the local machine and click Upload.
Let us know in the comments if you run into trouble or need any assistance.
[Need assistance with a different issue? Our team is available 24/7.]
Conclusion
To wrap things up, our Support Engineers demonstrated how to backup a database in cPanel by Cronjob. We also got a look at how to restore the database from a backup file.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
0 Comments