docker-应用

2023-03-01 17:30:58 浏览数 (1)

文章目录[隐藏]

  • mysql

mysql

代码语言:javascript复制
 docker run --name mysql --restart=always --network abc -e TZ=Asia/Shanghai -v $PWD/conf:/etc/mysql/conf.d -v $PWD/logs:/logs -v $PWD/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d -i -p 3307:3306 mysql:latest 

设置sql_mode

代码语言:javascript复制
echo "sql_mode =STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION" >> /etc/mysql/my.cnf

设置时区

echo "default-time_zone=' 8:00'" >> /etc/mysql/my.cnf

常用配置my.cnf

代码语言:javascript复制
[mysqld]
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
skip-name-resolve
max_connections=1500
# 超时时间默认28800(8小时)
wait_timeout=3600

0 人点赞