MySQL Database Backup

At the bottom of “Deploy MySQL” article in docs it recommends to use mysqldump to backup my database. I have a background worker instance and I want it to execute the backup command for my database running on a private service. However I can’t figure out how to connect to the service to execute the command in its shell?

Hi,

The “Shell” tab of your Background Worker would give you access to run commands. You’d then use the internal host:port of your MySQL Private Service as part of the command.

Alan

Thank you for your reply. However whenever I execute a command on the background worker it complains that mysqldump is not found or cannot be executed (by returning “non-zero exit status 127”). I use python subprocess to execute the following command:

mysqldump -h {internal host} -P {internal port} -u root --password={root password} database contacts > /var/lib/mysql/backup/contacts.sql

What am I doing wrong?

If you’re using a Render Native Runtime on your Background Worker, these don’t include MySQL client tools.

You would need to use Docker to install the MySQL tools you need.

Alan

Ok, thank you, that’s what I thought I’ll need to do. I wanted to see if it can be done using Render Native Runtime.