Let’s face it, when was the last time you performed a database backup? How about any backup??? PyMyDB was written to help ease the burden of performing MySQL and MariaDB database backups.
Statistics have shown that businesses do not perform regular backups on their IT resources. Worse yet, many businesses close up shop after a major catastrophe due to inadequate backups. What does your backup solution look like?
Written in Python3 and using Boto3 and MySQLdb Python modules, PyMyDB connects to the server, queries all databases that the user has access to, and then performs a MySQL dump. To connect to the database, you must have an account with Amazon Web Services and use Secrets Manager. Secrets Manager is a simple tool allowing you to securely store any number of secrets.
The script looks for three stored secrets in Secrets Manager, username; password; and hostname. Once that information is saved in the system, grab the storage location and region name and plug that into the script. When working properly, the script will perform a backup of all the databases stored on the server.
The script can be found at: https://github.com/jasonbrown17/pymydb
The PyMyDB script now has S3 upload functionality. Add the S3 bucket name to the variable for offsite backups.