MySQL Backup: Backing Up Your Database
Follow the steps below when the business library needs to generate backup files daily, hourly, or continuously in a fixed window.
Steps to follow
- Confirm app.toml, bak.toml, prj.toml exist; tune MySQL, output dir, encryption, and upload in bak.toml.
bak.tomlmust include:
[public]
bak_type = "db"
db_type = "mysql"
bak_location_type = "local" # or local_and_remote
[mysql]
mysql_ip = "127.0.0.1"
mysql_port = 3306
mysql_user_name = "your_user"
mysql_pwd = "your_password"
mysqldump_path = "/path/to/mysqldump"
# skip_ssl = true # Enable when TLS cert is untrusted
Specify the library name to back up in `prj.toml’:
[local]
prj_key = "your_project"
mysql_db_name = "your_db"
- When the certificate chain of the target MySQL is not trusted by the local client, it is decided whether to set
skip_sslin combination with the actual environment. - Perform a check first to confirm that the connection and configuration can be read normally:
peppykeep backup run --bak-type db --config-home /path/to/conf
- Perform a formal backup after the output is correct:
peppykeep backup run --apply --bak-type db --config-home /path/to/conf
- When retaining only local files, explicitly add
--no-upload:
peppykeep backup run --apply --bak-type db --config-home /path/to/conf --no-upload
- When uploading to the object store immediately after this task, explicitly add
--upload:
peppykeep backup run --apply --bak-type db --config-home /path/to/conf --upload
results verification
- ‘BakType’ is’ Db `in the pre-check or execute output (or Action indicates a database backup).
- The backup file has been generated at the location specified in the configuration.
.ppkwhen not encrypted;.ppkewhen encryption is on.- The number of local history files matches this configuration.
When you need to process multiple libraries at once under the same MySQL instance, check Bulk backup of multiple MySQL libraries with the same instance.
Order Details: