This commit is contained in:
xxx
2024-06-05 17:24:49 +08:00
parent f5047edd91
commit 37fccc1f40
9 changed files with 1750 additions and 17 deletions

18
docker/mysql/Dockerfile Normal file
View File

@@ -0,0 +1,18 @@
FROM mysql:8.1
# 时区配置
ARG TZ=UTC
ENV TZ ${TIMEZONE}
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone && chown -R mysql:root /var/lib/mysql/
# 复制自定义的my.cnf
COPY my.cnf /etc/mysql/conf.d/my.cnf
# my.cnf只读权限
RUN chmod 0444 /etc/mysql/conf.d/my.cnf
# 暴露3306端口
EXPOSE 3306
# 启动mysql
CMD ["mysqld"]

12
docker/mysql/my.cnf Normal file
View File

@@ -0,0 +1,12 @@
# The MySQL Client configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysql]
default-character-set=utf8mb4
[mysqld]
sql-mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"
character-set-server=utf8mb4
default-authentication-plugin=mysql_native_password