docker安装mysql8注意事项
my.cnf
[mysqld] lower-case-table-names=1 log-bin=/var/lib/mysql/mysql-bin server-id=1 binlog_expire_logs_seconds=259200 pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock datadir = /var/lib/mysql secure-file-priv= NULL character_set_server=utf8 collation-server=utf8_general_ci max_connections=1000 [client] default-character-set=utf8
docker-compose.yml
version : '3' services: mysql: container_name: mysql image: mysql:8 build: context: ./mysql ports: - "3306:3306" volumes: - ./mysql/conf/my.cnf:/etc/mysql/my.cnf - ./mysql/logs:/logs - ./mysql/data:/var/lib/mysql - ./mysql/init-sql/:/docker-entrypoint-initdb.d command: [ '--character-set-server=utf8mb4', '--collation-server=utf8mb4_general_ci', '--max_allowed_packet=128M', '--innodb-buffer-pool-size=256M', '--default-time-zone=+08:00' ] environment: MYSQL_USER: 'xxxx' MYSQL_PASSWORD: 'xxxx' MYSQL_DATABASE: 'xxxx' MYSQL_ROOT_PASSWORD: 'xxxx' restart: always
注意data目录 ,最好用最高权限:
chmod 777 data
============ 欢迎各位老板打赏~ ===========
与本文相关的文章
- · Amazon Linux 2023 安装Docker和Docker Compose
- · 修改Docker的默认网段
- · docker定时任务Mysql脚本
- · 解决Linux实例磁盘空间满问题
- · failed to fetch metadata: fork/exec /home/appuser/.docker/cli-plugins/docker-buildx: exec format error
- · Docker登录login报错Error saving credentials
- · .NET8 Mysql SSL error
- · 黑群晖docker无法pull镜像,x509错误解决方法
- · k3s+kuboard快速搭建K8s生产环境集群
- · 解决es报错:blocked by: [FORBIDDEN/12/index read-only / allow delete (api) ]
- · filebeat按docker容器名创建不同的索引
- · traefik负载均衡/滚动升级