mysqldump managed database through cron


I got below: mysqldump -u doadmin -p -h -P 25060 --single-transaction --set-gtid-purged=OFF your_database_name \


Trying to use this in a cronjob without success (adding password to above). Is it not doable to mnysqldump a digitalocean managed database through cronjob?

I noticed “The application prompts you for your MySQL doadmin user password.” from above URL. Does that mean you cant authenticate through cron command?


Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Bobby Iliev
Site Moderator
Site Moderator badge
February 15, 2022


What I could suggest is following the steps from this tutorial here on how to how to create an export script to backup your database:

It suggests the following:

In order to do that you need to make sure that you have the following content in your .my.cnf file. The file should be stored at:


You should make sure that it has secure permissions:

chmod 600 /home/your_user/.my.cnf

And you should add the following content:


Once you have your .my.cnf file configured, you set up a cronjob to trigger the mysqldump export of your database.

Let me know how it goes!