无法将mysql文件夹绑定到windows 10文件夹获取mbind错误

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

大约一年前,我可以将一个windows文件夹绑定到dockermysql文件夹。
当我尝试用docker MySQL8.0.12做同样的事情时,我不能将windows文件夹绑定到mysql。我在mysql的日志中看到mbind:操作是不允许的。

services:
  mysql-docker-container:
    image: mysql:8.0.12
    environment:
      - MYSQL_ROOT_PASSWORD=***
      - MYSQL_DATABASE=spring_app_db
      - MYSQL_USER=app_user
      - MYSQL_PASSWORD=***
    volumes:
      - k:/zut/docker/storage:/var/lib/mysql
    ports: 
      - "3306:3306"

该文件夹是一个现有但为空的文件夹。我看到各种各样的帖子,但没有简单的解决办法。你能帮我找到那个好办法吗?我删除了所有以前的容器和图像。
当尝试重新安装MySQL5.7.*或5.6时,我会遇到各种各样的错误。
我可以看到windows文件夹一直是空的。
我应该在virtualbox中配置一些东西吗?共享文件夹?一年前我必须这么做。
日志信息(按要求)为:

$ docker-compose -f docker-compose2.yml up
WARNING: The Docker Engine you're using is running in swarm mode.

Compose does not use swarm mode to deploy services to multiple nodes in a swarm. All containers will be scheduled on the current node.

To deploy your application across the swarm, use `docker stack deploy`.

Starting dockercomposespringbootmysql_mysql-docker-container_1 ... done
Attaching to dockercomposespringbootmysql_mysql-docker-container_1
mysql-docker-container_1  | 2018-09-02T13:53:15.776081Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
mysql-docker-container_1  | 2018-09-02T13:53:15.776168Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.12) starting as process 1
mysql-docker-container_1  | mbind: Operation not permitted
mysql-docker-container_1  | 2018-09-02T13:53:15.986113Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
mysql-docker-container_1  | 2018-09-02T13:53:16.053452Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
mysql-docker-container_1  | 2018-09-02T13:53:16.060630Z 0 [Warning] [MY-010315] [Server] 'user' entry 'mysql.infoschema@localhost' ignored in --skip-name-resolve mode.
mysql-docker-container_1  | 2018-09-02T13:53:16.060890Z 0 [Warning] [MY-010315] [Server] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
mysql-docker-container_1  | 2018-09-02T13:53:16.061308Z 0 [Warning] [MY-010315] [Server] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
mysql-docker-container_1  | 2018-09-02T13:53:16.061722Z 0 [Warning] [MY-010315] [Server] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
mysql-docker-container_1  | 2018-09-02T13:53:16.062252Z 0 [Warning] [MY-010323] [Server] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
mysql-docker-container_1  | 2018-09-02T13:53:16.062621Z 0 [Warning] [MY-010323] [Server] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
mysql-docker-container_1  | 2018-09-02T13:53:16.063088Z 0 [Warning] [MY-010311] [Server] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
mysql-docker-container_1  | 2018-09-02T13:53:16.068879Z 0 [Warning] [MY-010330] [Server] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
mysql-docker-container_1  | 2018-09-02T13:53:16.069353Z 0 [Warning] [MY-010330] [Server] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
7y4bm7vi

7y4bm7vi1#

答案1:通过oracle vm virtualbox共享文件夹
启动oracle vm virtualbox并运行“默认”虚拟机。在“设置”>“共享文件夹”中选择“默认设置”。添加共享文件夹名='d/zut',windows上的文件夹='d:\zut',并授予其所有权限并保持其持久性。
在docker compose文件中,可以使用该Map:

volumes:
  - //d/zut:/var/lib/mysql

答案2:命名卷
如果第一个解决方案遇到问题,可以使用docker“命名卷”。docker管理持久卷。访问数据要复杂一点;-)
在docker-compose.yml文件中添加(在第一个'zut'no'/'之前)

services:
  mysql-docker-container:
    image: mysql:8.0.12
      environment:
        - MYSQL_PASSWORD=***etc etc
    volumes:
      - zut:/var/lib/mysql
    ports: 
      - "3306:3306"

  volumes:
    zut:

相关问题