Skip to content

Configuring The Database

Generating The Database

We use doctrine/doctrine-fixtures-bundle to generate the database schema and populate it with test data. This is done automatically when the container is started for the first time through DDEV's hooks defined in .ddev/config.yaml.

Note


Exporting A Database

  1. Open PHPMyAdmin in your browser.
  2. Select the database you want to export.
  3. Click the "Export" tab.
  4. Choose the export method you want to use.

Export as a gunzip file .sql.gz

ddev export-db --database=my_database_name --file=./path/to/export.sql.gz

Export as a gunzip file .sql.gz

mysqldump -u username -p database_name | gzip > ./path/to/export.sql.gz

Eport as an SQL file .sql

mysqldump -u username -p database_name > ./path/to/export.sql

Importing A Database

  1. Open PHPMyAdmin in your browser.
  2. Select the database you want to import to.
  3. Click the "Import" tab.
  4. Choose the import method you want to use.

Import as a gunzip archive .gz

ddev import-db --database=my_database_name --file=./path/to/import.sql.gz

Import a gunzip archive .gz

gunzip < ./path/to/export.sql.gz | mysql -u username -p database_name

Import an SQL file .sql

mysql -u username -p database_name < ./path/to/export.sql