How can ddev automatically create additional datab

2019-04-10 23:00发布

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.

标签: ddev
1条回答
劳资没心,怎么记你
2楼-- · 2019-04-10 23:37

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'@'%';"
查看更多
登录 后发表回答