分类

链接

2024 年 7 月
1234567
891011121314
15161718192021
22232425262728
293031  

近期文章

热门标签

新人福利,免费薅羊毛

现在位置:    首页 > MySQL > 正文
共享办公室出租
docker安装mysql8注意事项
MySQL 暂无评论 阅读(86)

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

 

============ 欢迎各位老板打赏~ ===========

本文版权归Bruce's Blog所有,转载引用请完整注明以下信息:
本文作者:Bruce
本文地址:docker安装mysql8注意事项 | Bruce's Blog

发表评论

留言无头像?