如何修复 mysql 错误日志中的“ mbind: Operation not allow”

我的 MySQL 错误日志有一个问题,它目前主要由“ mbind: Operation not allow”行组成(见下文)。为什么会这样,我该怎么补救?

“大部分”这部分让我很困扰。正如您在下面看到的,并非所有行都是“绑定: 不允许操作”。我怀疑 MySQL 查询错误应该代替这一行,但由于某些原因它们不能写入文件。

MySQL 本身是一个 Docker 容器,日志文件通过以下方式进行卷积:

volumes:
- ./mysql/log:/var/log/mysql

有趣的是:

  • “ docker log mysql _ Container”没有显示任何内容..。
  • Log 位于同一个卷文件夹中,完全没问题,并且其中有非常慢的日志行,没有任何“绑定: 操作不允许”之类的内容!
  • 与 slow.log 转到 general.log 一样ー这里也没有问题

有什么想法吗? 先谢谢你。

2019-04-07T12:56:22.478504Z 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.
2019-04-07T12:56:22.478533Z 0 [Warning] [MY-011068] [Server] The syntax 'expire-logs-days' is deprecated and will be removed in a future release. Please use binlog_expire_logs_seconds instead.
2019-04-07T12:56:22.478605Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.15) starting as process 1
2019-04-07T12:56:22.480115Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2019-04-07T12:56:22.480122Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
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
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
[same line goes forever]

附注: MySQL 的启动和运行都很好,没有问题。只是这个 error.log 一直困扰着我,让我看不到真正的错误。

83792 次浏览

Adding the security_opt option in docker-compose.yml helped to solve this problem:

database:
image: mysql:latest
container_name: mysql_0
ports:
- "3306:3306"
security_opt:
- seccomp:unconfined

Add the capability CAP_SYS_NICE to your container until MySQL server can handle the error itself "silently".

service:
mysql:
image: mysql:8.0.15
# ...
cap_add:
- SYS_NICE  # CAP_SYS_NICE

If you dont have docker-compose, then you can define CAP_SYS_NICE via

docker run --cap-add=sys_nice -d mysql

References: