Opens a mysql
prompt to the mysql database container
./mysql/run-prompt.sh <CONTAINER>
Runs an sql script against the mysql database container
./mysql/run-sql.sh <CONTAINER> <SCRIPT>
The MySQL image can be changed by setting IMAGE
(e.g. IMAGE=mysql:5
).
If not set, it will default to mysql:5.6
.
USERNAME=? \
PASSWORD=? \
HOST=? \
mysql/client/run-prompt.sh
The backup is written to a file name as <DATABASE>-YYYY-MM-DD-HH-mm-ss.sql
.
Backups can be written locally or to an S3 bucket.
Create a backup from a MySQL database and write it locally.
DATABASE=? \
USERNAME=? \
PASSWORD=? \
HOST=? \
mysql/client/backup-db.sh
Create a backup from a MySQL database and write it in the given S3 bucket.
S3_BUCKET=s3://mybucket/backups \
DATABASE=? \
USERNAME=? \
PASSWORD=? \
HOST=? \
mysql/client/backup-db.sh
The SQL scripts can be stored locally or in an S3 bucket. This approach can be used
to apply backups to existing MySQL instances. To apply a backup over the top of
an existing database (e.g. in a dev/test environment), you will need to add the drop database <name>;
record to the top of the backup file.
Create a backup from a MySQL database and write it locally.
USERNAME=? \
PASSWORD=? \
HOST=? \
mysql/client/run-sql.sh /path/to/script.sql
Create a backup from a MySQL database and write it in the given S3 bucket.
USERNAME=? \
PASSWORD=? \
HOST=? \
mysql/client/run-sql.sh s3://mybucket/backups/script.sql
When interacting with S3, it is possible to provider extra args with S3_ARGS
environment variable. For example, you may wish to run S3_ARGS=--sse
to ensure
server-side encryption is set.