fix mysql error no access
This commit is contained in:
parent
094aa9beb1
commit
007017a2a7
@ -12,24 +12,8 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
RUN chown -R mysql:root /var/lib/mysql/
|
||||
|
||||
ADD startup /etc/mysql/startup
|
||||
|
||||
ARG MYSQL_DATABASE=default
|
||||
ARG MYSQL_USER=default
|
||||
ARG MYSQL_PASSWORD=secret
|
||||
ARG MYSQL_ROOT_PASSWORD=root
|
||||
|
||||
ENV MYSQL_DATABASE=$MYSQL_DATABASE
|
||||
ENV MYSQL_USER=$MYSQL_USER
|
||||
ENV MYSQL_PASSWORD=$MYSQL_PASSWORD
|
||||
ENV MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD
|
||||
|
||||
RUN sed -i 's/MYSQL_DATABASE/'$MYSQL_DATABASE'/g' /etc/mysql/startup && \
|
||||
sed -i 's/MYSQL_USER/'$MYSQL_USER'/g' /etc/mysql/startup && \
|
||||
sed -i 's/MYSQL_PASSWORD/'$MYSQL_PASSWORD'/g' /etc/mysql/startup
|
||||
|
||||
ADD my.cnf /etc/mysql/conf.d/my.cnf
|
||||
|
||||
CMD ["mysqld", "--init-file=/etc/mysql/startup"]
|
||||
CMD ["mysqld"]
|
||||
|
||||
EXPOSE 3306
|
||||
|
@ -1,3 +0,0 @@
|
||||
DROP USER MYSQL_USER;
|
||||
CREATE DATABASE IF NOT EXISTS MYSQL_DATABASE;
|
||||
GRANT ALL ON `MYSQL_DATABASE`.* TO 'MYSQL_USER'@'%' IDENTIFIED BY 'MYSQL_PASSWORD';
|
Loading…
Reference in New Issue
Block a user