Closed 70599 closed 3 years ago
The % represents a wildcard for any host, although this isn't secure you should be fine grain tuning the permissions based on your database, hosts and users to minimise the risk of attack surface by only having the required for what you need. A super admin is really only useful for dev and shouldn't really exist in a production env.
You could also add the required line into the run.sh to achieve what you are doing;
echo "GRANT ALL ON \`$MYSQL_DATABASE\`.* to '$MYSQL_USER'@'localhost' IDENTIFIED BY '$MYSQL_PASSWORD';" >> $tfile
if [ "$MYSQL_USER" != "" ]; then
echo "[i] Creating user: $MYSQL_USER with password $MYSQL_PASSWORD"
echo "GRANT ALL ON \`$MYSQL_DATABASE\`.* to '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD';" >> $tfile
echo "GRANT ALL ON \`$MYSQL_DATABASE\`.* to '$MYSQL_USER'@'localhost' IDENTIFIED BY '$MYSQL_PASSWORD';" >> $tfile
fi
fi
Thank you. Edited run.sh
and mounted it by volumes
, worked as expected.
Maybe because the hostname is
%
notlocalhost
in the line ↓ https://github.com/yobasystems/alpine-mariadb/blob/cbe54513e283d486a8b1ef6a0cdc45f4354f8724/alpine-mariadb-amd64/files/run.sh#L67Had try to create another database/user, and replace
%
tolocalhost
. Then worked.