ubuntu mysqldump to azure storage

mysqldump user

create user 'dumper'@'localhost' identified by 'password';
GRANT ALL PRIVILEGES ON *.* To 'dumper'@'localhost';

my.cnf

sudo vim /etc/mysql/my.cnf
[mysqldump]
user=dumper
password=secret

root is owner and group of .my.cnf

Test it

mysqldump --all-databases > /home/user/backups/db-backup.sql

Install Azure-cli

Backup script

sudo chmod a+x /home/user/dump.sh
whereis mysql
whereis node
whereis azure

Make sure you reference the full Azure CLI & Node JS path for the azure command. The cron doesn’t know where they are.

Test it

sh dump.sh

crontab

Let the machine do the work.

references
azure example script
– azure cli commands
azure-cli github
mensfeld separate database dumps