2

ddev has these default settings:

database: db
dbuser: db
password: db

I thought it should be possible to provide customized values for that (I know it doesn't make too much sense, but still). I was looking for these settings in config.yaml, but no luck.

Is it possible to modify those credentials and add them to git?

Urs
  • 4,984
  • 7
  • 54
  • 116

1 Answers1

6

You can change database credentials any time if it seems useful to you. You have full root on the mysql database. So ddev mysql -uroot -proot will get you in there where you can GRANT ALL on db.* to 'mynewuser'@'%' IDENTIFIED BY 'mynewpassword'; That will create a new user with full privs on the 'db' database. But you can also create new databases and new users as much as you want. And if you want, you can change the password of the 'db' user. We try to make it as simple as possible for local dev... but if you want to make it more complicated, go for it!

There are a couple of items in the FAQ that may help as well - about multiple databases and database credentials.

If you remove the default credentials, of coures, you have to change your CMS's settings files to credentials that will work.

rfay
  • 9,963
  • 1
  • 47
  • 89
  • Thanks @rfay! And to script that, I add it to `.ddev/commands/dv/mysql` right? – Urs Jan 17 '20 at 13:15
  • But that's in ddev's `.gitignore`: `/commands/db/mysql`, is it ok to add that to git? – Urs Jan 17 '20 at 13:17
  • No, I wouldn't change the `ddev mysql` command, which is a way to get to the mysql client. If you want it to add a user or something, you could do it in a post-start or post-import-db hook, I'd think that would be better. Maybe something along the lines of https://github.com/drud/ddev-contrib/tree/master/hook-examples/import-db-if-empty – rfay Jan 17 '20 at 15:23