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
CREATE DATABASE newdb;
GRANT ALL ON newdb.* to 'db'@'%' IDENTIFIED BY 'db';
ddev import-db --target-db=newdb --src=dumpfile.sql
More details about database management at https://ddev.readthedocs.io/en/latest/users/topics/database_management/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With