4

求教 Docker Componse 部署 mysql 配置默认密码失效

 1 year ago
source link: https://www.v2ex.com/t/912233
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  程序员

求教 Docker Componse 部署 mysql 配置默认密码失效

  cMoon · 10 小时 13 分钟前 · 1017 次点击

想自己搭一个博客( halo

按照文档Halo Documents通过 docker componse 创建 Halo + MySQL 的实例。halo 启动报错,连接数据库 Access denied

参考https://blog.csdn.net/qq_36493719/article/details/104246271未解决

docker-componse.yml:

version: "3"

services:
  halo:
    image: halohub/halo:2.1.0
    container_name: halo
    restart: on-failure:3
    depends_on:
      halodb:
        condition: service_healthy
    networks:
      halo_network:
    volumes:
      - ./:/root/.halo2
    ports:
      - 6666:8090
    command:
      - --spring.r2dbc.url=r2dbc:pool:mysql://xxx:3316/halo
      - --spring.r2dbc.username=root
      # MySQL 的密码,请保证与下方 MYSQL_ROOT_PASSWORD 的变量值一致。
      - --spring.r2dbc.password= halodb
      - --spring.sql.init.platform=mysql
      # 外部访问地址,请根据实际需要修改
      - --halo.external-url=http://xxx/
      # 初始化的超级管理员用户名
      - --halo.security.initializer.superadminusername=admin
      # 初始化的超级管理员密码
      - --halo.security.initializer.superadminpassword=pwd@halo

  halodb:
    image: mysql:8.0.31
    container_name: halodb
    restart: on-failure:3
    networks:
      halo_network:
    command:
      - --default-authentication-plugin=mysql_native_password
      - --character-set-server=utf8mb4
      - --collation-server=utf8mb4_general_ci
      - --explicit_defaults_for_timestamp=true
    volumes:
      - ./mysql:/var/lib/mysql
      - ./mysqlBackup:/data/mysqlBackup
      - ./mysqlConf/my.cnf:/etc/mysql/my.cnf
    ports:
      - 3316:3306
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"]
      interval: 3s
      retries: 5
      start_period: 30s
    environment:
      MYSQL_ROOT_PASSWORD: halodb
      TZ: Asia/Shanghai
      MYSQL_DATABASE: halo

networks:
  halo_network:

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK