Skip to content

Mysql Backup

Darwin Correa edited this page Apr 2, 2016 · 1 revision

Mysql Backup Script

Please see example included in autobackup-dcm πŸ“¦

Script file: mysql_backup.py Config File: mysql_config.json

[
  {
	 "cfg": {
     "local_backup_dir": "../backup_test_files/jom_backups/",
     "remote_backup_dir": "google_folder_id",
     "google_credentials_name": "jom_google_credentials.json",
     "app_name": "jom",
     "google_authorized": false
    },
    "bk": {
      "last_week": 13,
      "last_year": 2016,
      "last_day": 2,
      "last_month": 4
    },
    "rotate": {
      "local": {
        "monthly": 12,
        "yearly": 2,
        "weekly": 4,
        "daily": 7
      },
      "remote": {
        "monthly": 12,
        "yearly": 3,
        "weekly": 4,
        "daily": 7
      },
      "include_list": [],
      "exclude_list": [],
      "dry_run": false,
      "ionice": "idle",      
    },    
    "custom": {
      "db_user": "jom",
      "db_name": "jom",
      "db_host": "localhost",
      "db_password": "jom"
    }
  },
	  {}
]
Key Type Mandatory Description
custom JSON Object πŸ‘ Mysql configuration of app
db_user String πŸ‘ Mysql User with full acces to database
db_name String πŸ‘ Mysql Database name to backup
db_host String πŸ‘ Host of Mysql (Localhost, Name, or IP)
db_password String πŸ‘ Password of User Database

If you not want store password, you should go to official Mysql documentation to mysqldump without password and modify script to support it

Modify Script

You are free of modified the mysql_backup.py script to adapt to your needs.

πŸ“š The mysql_backup.py script is well documented. (maybe) 😩

Clone this wiki locally