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

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s