Is there a way to change the default configuration for the database in a ddev project and save the changes into the project repository?
I mean change the database name, the database usernames and passwords. I see entries for the type of database in config.yaml, but I want to use a database name other than "db". Is this possible?
DDEV uses db
by default, but you can add more databases manually and use them instead of db
.
More info about DDEV database management.
Example for MariaDB/MySQL, go to the mysql
CLI:
ddev mysql -uroot -proot
Create database and user:
CREATE DATABASE IF NOT EXISTS some_new_database;
CREATE USER 'username'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON some_new_database.* TO 'username'@'%' WITH GRANT OPTION;
The above can be automated using hooks.
And don't forget to disable settings management, so DDEV won't write default db
to your env (if you use framework):
ddev config --disable-settings-management