mysql 5.7数据目录中有文件

iovurdzv  于 2021-06-20  发布在  Mysql
关注(0)|答案(1)|浏览(331)

在以下位置完成教程:https://docs.docker.com/compose/wordpress/
运行docker compose我得到:

Initializing database
[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
[ERROR] --initialize specified but the data directory has files in it. Aborting.
[ERROR] Aborting

尝试添加此处建议的参数:https://github.com/docker-library/mysql/issues/186https网址:github.com/docker-library/mysql/issues/69
但这似乎行不通:

services:
  db:
    image: mysql:5.7
    command: ["mysqld", "--ignore-db-dir=lost+found", "--explicit_defaults_for_timestamp"]
    volumes:
      - db_data:/var/lib/mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: somewordpress
      MYSQL_DATABASE: wordpress
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: wordpress

还有别的解决办法吗?

i5desfxk

i5desfxk1#

我用以下方法解决了这个问题:

docker volume prune

删除所有未使用的本地卷。未使用的本地卷是指未被任何容器引用的卷
https://docs.docker.com/engine/reference/commandline/volume_prune/

相关问题