Skip to content

Commit 1777bc5

Browse files
User creation
1 parent 1e3cc9b commit 1777bc5

File tree

1 file changed

+5
-1
lines changed
  • docs/examples/sqlcommenter/books_database

1 file changed

+5
-1
lines changed

docs/examples/sqlcommenter/books_database/Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ ENV MYSQL_PASSWORD=books123
77

88
ADD books.sql /docker-entrypoint-initdb.d/
99

10+
RUN echo "CREATE USER IF NOT EXISTS 'books'@'%' IDENTIFIED WITH mysql_native_password BY 'books123';" > /docker-entrypoint-initdb.d/01-create-user.sql && \
11+
echo "GRANT ALL PRIVILEGES ON books.* TO 'books'@'%';" >> /docker-entrypoint-initdb.d/01-create-user.sql && \
12+
echo "FLUSH PRIVILEGES;" >> /docker-entrypoint-initdb.d/01-create-user.sql
13+
1014
# Prepare general logs
1115
RUN mkdir -p /var/log && \
1216
touch /var/log/general.log && \
@@ -18,4 +22,4 @@ HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
1822
CMD mysqladmin ping -p${MYSQL_ROOT_PASSWORD} || exit 1
1923

2024
# Start MySQL with general logging enabled and compatible authentication
21-
CMD ["mysqld", "--general-log=1", "--general-log-file=/var/log/general.log", "--default-authentication-plugin=mysql_native_password"]
25+
CMD ["mysqld", "--general-log=1", "--general-log-file=/var/log/general.log"]

0 commit comments

Comments
 (0)