2cript
This commit is contained in:
parent
3af8c81dc4
commit
25a4ffacd1
@ -18,5 +18,5 @@ RUN sed -i 's/bind-address/bind-address = 0.0.0.0 #/i' /etc/mysql/mariadb.conf.d
|
|||||||
RUN mkdir /mysql_scripts
|
RUN mkdir /mysql_scripts
|
||||||
COPY ./tools/ /mysql_scripts/
|
COPY ./tools/ /mysql_scripts/
|
||||||
EXPOSE 3306
|
EXPOSE 3306
|
||||||
|
WORKDIR /mysql_scripts
|
||||||
ENTRYPOINT ["bash", "mysql_scripts/sqlStart.sh"]
|
ENTRYPOINT ["bash", "sqlStart.sh"]
|
||||||
4
srcs/requirements/mariadb/tools/db.sh
Normal file
4
srcs/requirements/mariadb/tools/db.sh
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
CREATE DATABASE IF NOT EXISTS wordpress;
|
||||||
|
CREATE USER IF NOT EXISTS '${MARIADB_USER}'@'%' IDENTIFIED BY '${MARIADB_PASSWORD}';
|
||||||
|
GRANT ALL PRIVILEGES ON *.* TO '${MARIADB_USER}'@'%';
|
||||||
|
FLUSH PRIVILEGES;
|
||||||
1
srcs/requirements/mariadb/tools/pwd.sh
Normal file
1
srcs/requirements/mariadb/tools/pwd.sh
Normal file
@ -0,0 +1 @@
|
|||||||
|
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('$MARIADB_ROOT_PASSWORD');
|
||||||
@ -2,15 +2,12 @@
|
|||||||
|
|
||||||
service mysql start
|
service mysql start
|
||||||
|
|
||||||
mysql << EOF
|
if [ ! -d /var/lib/mysql/wordpress ]
|
||||||
|
then
|
||||||
CREATE DATABASE IF NOT EXISTS ${MARIADB_DATABASE};
|
echo "----sql config----"
|
||||||
CREATE USER IF NOT EXISTS '${MARIADB_USER}'@'%' IDENTIFIED BY '${MARIADB_PASSWORD}';
|
mysql < db.sh
|
||||||
GRANT ALL PRIVILEGES ON *.* TO '${MARIADB_USER}'@'%';
|
#mysql -u root < pwd.sh
|
||||||
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('$MARIADB_ROOT_PASSWORD');
|
|
||||||
FLUSH PRIVILEGES;
|
|
||||||
EOF
|
|
||||||
|
|
||||||
|
fi
|
||||||
service mysql stop
|
service mysql stop
|
||||||
mysqld
|
mysqld
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user