我有一个 Drupal 多站点,每个站点需要一个数据库,并希望它在 ddev 中运行,但 ddev 默认只有一个数据库,名为db".如何获得第二个数据库?
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?
您可以使用 ddev import-db --target-db=newdb
直接导入其他数据库.创建的数据库已经有权限等
Youu can import additional databases directly with ddev import-db --target-db=newdb
. The created database will already have permissions, etc.
您还可以手动创建和管理数据库(尽管现在很少需要这样做了).数据库服务器的root密码是'root',所以你可以在里面mysql -uroot -proot
(或者使用ddev mysql -uroot -proot
).
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';
ddev import-db --target-db=newdb --src=dumpfile.sql
有关数据库管理的更多详细信息,请访问 https://ddev.readthedocs.io/en/latest/users/topics/database_management/
More details about database management at https://ddev.readthedocs.io/en/latest/users/topics/database_management/
这篇关于如何在 ddev 中创建和加载第二个数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!