How can I create and load a second database in ddev?


I have a Drupal multisite that needs to have one database for each site, and want it to run in ddev, but ddev just has the one database by default, named ‘db’. How can I get a second database?


Youu can import additional databases directly with ddev import-db --target-db=newdb. The created database will already have permissions, etc.

You can also manually create and manage databases (although this is rarely necessary any more). The root password for the db server is ‘root’, so you can mysql -uroot -proot in there (or use ddev mysql -uroot -proot).

  • ddev mysql -uroot -proot
  • GRANT ALL ON newdb.* to 'db'@'%' IDENTIFIED BY 'db';
  • Now, if you want to load from a db dump, ddev import-db --target-db=newdb --src=dumpfile.sql
  • Your normal web user can now access this alternate db, and it can be used in the settings.php for your alternate multisite.
  • There are many other things you’ll want to do for your Drupal multisite; there is a full tutorial at

More details about database management at

Answered By – rfay

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published