Skip to content

Allow changing password for db user #5723

@h1nds1ght

Description

@h1nds1ght

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem?

I have seen that there are several variables for the passwords of the root and db user inside the db container

MYSQL_PWD=db
MYSQL_ROOT_PASSWORD=root
MYSQL_PASSWORD=db

Would it be possible to read these variables from the .ddev/.env file, i.e. via

MYSQL_PASSWORD=db-changed
MYSQL_ROOT_PASSWORD=root-changed

and pass it to the /healtcheck.sh inside the db container?

While changing the root password currently works, changing the password of the db user seems to collide with the /healthcheck.sh of the db container, since the password is hardcoded

# If we can now access the server, we're healthy and ready
if  mysql --host=127.0.0.1 -udb -pdb --database=db -e "SHOW DATABASES LIKE 'db';" >/dev/null;  then
    printf "healthy"
    touch /tmp/healthy
    exit 0
fi

and the .ddev/.env file is not passed to the db container.

Of course i could create another user for this, but it would be more elegant to change the password of the existing db user only.

Describe your solution

  • Include .ddev/.env in db container or source it in /healtcheck.sh from /mnt/ddev_config/.env
  • Adjust /healtcheck.sh inside the db container to use the environment variable MYSQL_PASSWORD

Describe alternatives

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions