yobasystems/alpine-mariadb

root@localhost password is wiped upon database creation.

JourdanClark opened this issue · 3 comments

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

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.

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

this should be fixed.