Create database dump on Adobe Commerce on cloud infrastructure
This article discusses the possible (and recommended) ways to create a database (DB) dump on Adobe Commerce on cloud infrastructure.
You only need to use one variant (option) to dump your DB. These options apply to any environment type (Integration, Staging, Production) and any plan (Adobe Commerce on cloud infrastructure Starter plan architecture and Adobe Commerce on cloud infrastructure Pro plan architecture).
Prerequisite: SSH to your environment
To dump your DB on Adobe Commerce on cloud infrastructure with any variant discussed in this article, you must first SSH to your environment.
Option 1: db-dump (ece-tools; recommended)
You may dump your DB using the ECE-Tools command:
vendor/bin/ece-tools db-dump
This is the recommended and safest option.
See Dump your database (ECE-Tools) in our Commerce on Cloud Infrastructure Guide.
Option 2: mysqldump
You may dump your DB using the native MySQL mysqldump
command.
The entire command might look as follows:
mysqldump -h <host> -u <username> -p <password> --single-transaction <db_name> | gzip > /tmp/<dump_name>.sql.gz
The database backup created by running the mysqldump
command and saved in \tmp
, should be moved from this location. It should not take up storage space in \tmp
(which might result in problems).
To obtain your DB credentials (host, username, and password), you might call the MAGENTO_CLOUD_RELATIONSHIPS
environment variable:
echo $MAGENTO_CLOUD_RELATIONSHIPS |base64 --d |json_pp
Related documentation:
- mysqldump – A Database Backup Program in official MySQL documentation.
- Cloud-specific variables (see
MAGENTO_CLOUD_RELATIONSHIPS
) in our Commerce on Cloud Infrastructure Guide.