How can ddev automatically create additional databases?

旧街凉风 提交于 2019-12-06 03:47:01

问题


This is a followup question to How can I create and load a second database in ddev?. It is about doing that task automatically.

One use case for this is developing a migration to Drupal from another MySQL database, and collaborating with others on the migration. If the database name can be set by ddev, additional developers can get the database created automatically, and additional databases can be added to their settings.local.php, using known values.


回答1:


Try this in your project's config.yaml:

hooks:
  post-start:
    - exec: mysql -uroot -proot -hdb -e "CREATE DATABASE IF NOT EXISTS another_db; GRANT ALL ON another_db.* TO 'db'@'%';"


来源:https://stackoverflow.com/questions/51253642/how-can-ddev-automatically-create-additional-databases

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!