WHCSRL 技术网

mysql:mbind: Operation not permitted

mbind: Operation not permitted

重启docker容器中的mysql时,会出现operation not permitted问题
查看docker容器中mysql倒数100行日志发现:

//docker logs --tail="100" mysql-server-5.2.6
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
mbind: Operation not permitted
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

原因是docker容器中有一个安全认证的环节。进入到docker-compose.yml配置文件中添加以下参数:

// 解决docker容器中的mysql安全认证问题
      security_opt:
        - seccomp:unconfined
  • 1
  • 2
  • 3

看成品配置:

version: '5.2.6'
  services:
    mysql:
      image: mysql
      container_name: mysql
      # docker安全验证
      security_opt:
        - seccomp:unconfined
      ports:
        - 3306:3306
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

重启之后解决成功!

推荐阅读