
The web and db containers come with mysqldump. The web and db containers are each ready with MySQL/PostgreSQL clients, so you can ddev ssh or ddev ssh -s db and use mysql or psql. You might run ddev mysql to use interactive commands like DROP DATABASE backend or SHOW TABLES, or do things like echo "SHOW TABLES " | ddev mysql or ddev mysql -uroot -proot to get root privileges. The ddev mysql and ddev psql commands give you direct access to the mysql and psql clients in the database container, which can be useful for quickly running commands while you work. Use the ddev snapshot restore command to interactively choose among snapshots, or append -latest to restore the most recent snapshot: ddev snapshot restore -latest. Then if you want to delete everything with ddev delete -O (omitting the snapshot since we have one already), and then ddev start again, we can ddev snapshot restore two-dbs and we’ll be right back where we were. It includes the entire state of the db server, so in the case of our two databases above, both databases and the system level mysql or postgres database will all be snapshotted. For example, ddev snapshot -name=two-dbs would make a snapshot named two-dbs in the. Snapshots can be named for easier reference later on. Snapshots let you easily save the entire status of all of your databases, which can be great when you’re working incrementally on migrations or updates and want to save state so you can start right back where you were. ddev export-db -target-db=backend -f will dump the database named backend. You can export in the same way: ddev export-db -f will export your default database ( db). For example, ddev import-db -target-db=backend -src= will create the database named backend with permissions for that same db user and import from the dumpfile. You can easily create and populate additional databases. If you want to change database type, you need to export your database, run ddev delete to remove the project (and its existing database), change to a new database type, run ddev start again, and import your data.ĭDEV creates a default database named db and default permissions for the db user with password db, and it’s on the (inside Docker) hostname db. You can use a variety of different database types, including MariaDB (5.5–10.8), MySQL (5.5–8.0), and PostgreSQL (9–15).


In-Container Home Directory and Shell Configuration.Defining Additional Services with Docker Compose.Additional Service Configurations & Add-ons.Database Management Database Management Table of contents.
