I created a wordpress server via Digitalocean backup did not work
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.
How To Backup All MySQL Databases ?
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:
$ mysqldump -u your_username -p --all-databases > alldatabases-$(date +%F).sql
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:
0 10,22 * * * /usr/bin/mysqldump -u your_username --all-databases > alldatabases-$(date +%F).sql
Also note that to run
mysqldump without a password, you need to add your MySQL username and password to
Restoring a MySQL dump ?
$ mysqldump -u your_username -p < alldatabases.sql
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.
Islam @ SimpleBackups