Hi, How to auto backup SQL backup on phpmyadmin? I use wordpress how can I get sql backups?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $100 of credit to try our products over 60 days!
Hi @erhanpaker1!
DigitalOcean does not specifically offer backups of MySQL on a droplet, you can use DigitalOcean backups for the whole droplet, but that does not give you a database dump that you can restore by itself.
You need to handle database backups on your own and there are many ways that range from automated services that need minimal configuration which you can use to help you do the job, to custom scripts that you could use and tailor to your exact needs.
The problem with relying on scripts is that they have too many points of failure and unless you know and test what you are doing you may risk not having your backups running as expected. We wrote a guide to dump and upload backups offsite step by step that you may find helpful here.
If you choose the backup script method and want to store MySQL backups locally, you could use the suggested and nicely written answer of @bobbyiliev but modify the dump command to:
Note that we use the
--all-databases
argument to dump all databases instead of specifying a particular one.Also make sure to modify the cron job entry to:
Also note that to run
mysqldump
without a password, you need to add your MySQL username and password tomy.cnf
.For example:
Note that you need to obviously replace
alldatabases.sql
by the actual name of the dump containing all databases.If you decide to use an automated service, check out ours, it will be helpful in this case.
Best, Islam @ SimpleBackups
Hi there @bobbyiliev
How To Backup All MySQL Databases ?
Restoring a MySQL dump ?
I created a wordpress server via Digitalocean backup did not work
Hi there @erhanpaker1,
I could suggest using
musqldump
with a cron job to do the backups rather than PHPmyAdmin.The command that you would need to use is the following:
Rundown of the arguments:
-u
: needs to be followed by your MySQL username-p
: indicates that you would be prompted for your MySQL password>
: indicates that the output of the command should be stored in the .sql file (that you specify after that signThen to add a cron job you could do the following, first edit your crontab:
Then add the following cron job:
For more information, you could take a look at this tutorial here.
Let me know if you have any questions. Regards, Bobby