yobasystems / alpine-mariadb

MariaDB running on Alpine Linux [Docker]
https://hub.docker.com/r/yobasystems/alpine-mariadb/
237 stars 71 forks source link

root@localhost password is wiped upon database creation. #21

Closed JourdanClark closed 5 years ago

JourdanClark commented 5 years ago

https://github.com/yobasystems/alpine-mariadb/blob/master/alpine-mariadb-amd64/files/run.sh#L50

Not sure if this is unintentional since it also calls DROP DATABASE test right after and sets the password for root@localhost right before... If it is intentional, it'd be nice if there was a flag to not clear the root@localhost password

dominictayloruk commented 5 years ago

Maybe this should be

UPDATE user SET password=PASSWORD("$MYSQL_ROOT_PASSWORD") WHERE user='root' AND host='localhost';

so that it is set to whatever is in the environment variable, so that access to the database can be had on every run time and that it is consistently set every time the container is launched.

JourdanClark commented 5 years ago

The query on line 50 is only ran the first time the container is launched (when it can't find an existing data directory).

dominictayloruk commented 5 years ago

this should be fixed.