3 4. Database Operations
René Kreijveld edited this page 2026-06-22 08:28:33 +02:00

Database Operations

jdbdump

Export the DDEV database to a SQL dump file. Run from inside your site folder.

Usage

jdbdump [-b] [-t] [-n] [-o] [-v] [-s] [-h]

Options

Option Description
-b Store the dump in the backup folder (configured as BACKUPFOLDER in the config file)
-t Add a date/time-stamp to the dump filename (e.g. <projectname>-db.20240315-143022.sql.gz)
-n Do not compress the dump with gzip (produces <projectname>-db.sql instead of <projectname>-db.sql.gz)
-o Overwrite existing dump file without prompting
-v Verbose - show all DDEV output
-s Silent - suppress all messages
-h Display help

Output

By default the dump is saved in the current directory as:

  • <projectname>-db.sql.gz - compressed (default)
  • <projectname>-db.sql - uncompressed (with -n)
  • <projectname>-db.<timestamp>.sql.gz - with timestamp (with -t)

With -b, the dump is saved in the BACKUPFOLDER instead of the current directory.

If a dump file already exists, you will be asked to confirm before overwriting (unless -o is used).

Examples

Standard compressed dump:

cd ~/Development/sites/mysite
jdbdump

Uncompressed dump with timestamp:

jdbdump -n -t

Dump to backup folder with timestamp:

jdbdump -b -t

Overwrite existing dump silently:

jdbdump -o -s

jdbdumptable

Dump a single table from the DDEV database to a SQL file. Run from inside your site folder.

Usage

jdbdumptable -t <tablename> [-n] [-v] [-s] [-h]

Options

Option Description
-t <tablename> The database table to dump. Required.
-n Do not compress the dump with gzip (produces <tablename>.sql instead of <tablename>.sql.gz)
-v Verbose - show all DDEV output
-s Silent - suppress all messages
-h Display help

Output

The dump is saved in the current directory as:

  • <tablename>.sql.gz - compressed (default)
  • <tablename>.sql - uncompressed (with -n)

Examples

Dump a single table (compressed):

cd ~/Development/sites/mysite
jdbdumptable -t jos_content

Dump a table without compression:

jdbdumptable -t jos_users -n

jdbdumpall

Create a database dump of all DDEV Joomla projects found under the ROOTFOLDER. Each dump is stored in the BACKUPFOLDER with a timestamp in the filename. Run from anywhere.

Usage

jdbdumpall [-n] [-v] [-s] [-h]

Options

Option Description
-n Do not compress the dumps with gzip
-v Verbose - show all DDEV output
-s Silent - suppress all messages
-h Display help

How it works

jdbdumpall scans ROOTFOLDER (up to 2 levels deep) for Joomla installations by looking for configuration.php. For each one found, it calls jdbdump -b -t to create a timestamped dump in the BACKUPFOLDER.

Both ROOTFOLDER and BACKUPFOLDER are configured in the config file.

Output

Each dump is saved in BACKUPFOLDER as:

  • <projectname>-db.<timestamp>.sql.gz - compressed (default)
  • <projectname>-db.<timestamp>.sql - uncompressed (with -n)

Examples

Dump all Joomla projects:

jdbdumpall

Dump all projects without compression:

jdbdumpall -n

jdbimp

Import a SQL dump file into the DDEV database. Run from inside your site folder.

Usage

jdbimp [-f <dumpfile>] [-d] [-v] [-s] [-h]

Options

Option Description
-f <dumpfile> Import a specific file instead of auto-detecting
-d Delete the dump file after a successful import
-v Verbose - show all DDEV output
-s Silent - suppress all messages
-h Display help

Auto-detection

When -f is not specified, jdbimp presents a list of database dumps where you can choose which one you want to import.:

Examples

Auto-detect and import:

cd ~/Development/sites/mysite
jdbimp

Import a database dump:

jdbimp
Available database dump files:
1. dump.sql
2. update.sql.gz

Enter number of file to import:

Import a specific file:

jdbimp -f backup-2024-03-15.sql.gz

Import with verbose output:

jdbimp -v