Issue
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?
Solution
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';
- 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 https://github.com/drud/ddev-contrib/tree/master/recipes/drupal8-multisite
More details about database management at https://ddev.readthedocs.io/en/latest/users/topics/database_management/
Answered By - rfay Answer Checked By - Timothy Miller (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.