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?
See Question&Answers more detail:osI 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?
See Question&Answers more detail:osUpdated 2020-06-02: In recent versions of ddev, you can import additional databases directly with ddev import-db --target-db=newdb
. The created database will already have permissions, etc.
The rest of the answer has been edited to bring it up to date...
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
CREATE DATABASE newdb;
GRANT ALL ON newdb.* to 'db'@'%' IDENTIFIED BY 'db';
ddev import-db --target-db=newdb --src=dumpfile.sql