Ubuntu 上 Docker 中的 MySQL:警告:全局可写配置文件被忽略

Zha*_*ang 5 java mysql docker

在我的 中/etc/mysql/my.cnf,我已经:!includedir /etc/mysql/mysql.conf.dconfiged ,并且根据https://dev.mysql.com/doc/refman/8.0/en/option-files.htmlmy.cnf ,我认为我的目录中的文件!includedir应该覆盖。/etc/mysql/my.cnf

但是我在重新启动 mysql 服务器时收到警告,并确认我的该文件World-writable config file /etc/mysql/mysql.conf.d/my.cnf is ignored中的配置不起作用。为什么会出现警告,以及如何使其发挥作用?my.cnf!includedir

语境:

Docker 中的 Ubuntu 16.04.3,mysql 5.7.22

笔记:

我知道如果我的cnf文件包含多个点可能不起作用:

https://serverfault.com/questions/918530/mysql-includedir-not-working

但我不认为我正在解决这个问题。

Jam*_*ond 6

将权限更改为 0444:

chmod 0444 my.cnf

然后将其安装到/etc/mysql/conf.d/

volumes:
    # Set mysql extra config:
    - my.cnf:/etc/mysql/conf.d/my.cnf
Run Code Online (Sandbox Code Playgroud)


dan*_*ack 1

请您的管理员修复权限,上游没问题:

$ docker run mysql find /etc/mysql -ls
Unable to find image 'mysql:latest' locally
latest: Pulling from library/mysql
a5a6f2f73cd8: Pull complete 
936836019e67: Pull complete 
283fa4c95fb4: Pull complete 
1f212fb371f9: Pull complete 
e2ae0d063e89: Pull complete 
5ed0ae805b65: Pull complete 
0283dc49ef4e: Pull complete 
a7e1170b4fdb: Pull complete 
88918a9e4742: Pull complete 
241282fa67c2: Pull complete 
b0fecf619210: Pull complete 
bebf9f901dcc: Pull complete 
Digest: sha256:b7f7479f0a2e7a3f4ce008329572f3497075dc000d8b89bac3134b0fb0288de8
Status: Downloaded newer image for mysql:latest
  4225047      0 drwxr-xr-x   3 root     root           57 Nov 16 01:12 /etc/mysql
  6324293      0 drwxrwxr-x   2 root     root           41 Nov 16 01:10 /etc/mysql/conf.d
  6324294      4 -rw-r--r--   1 root     root         1294 Oct  7 09:13 /etc/mysql/conf.d/mysql.cnf
  6324308      4 -rw-rw-r--   1 root     root           43 Nov 16 01:10 /etc/mysql/conf.d/docker.cnf
  4225049      4 -rw-r--r--   1 root     root         1469 Oct  7 09:13 /etc/mysql/my.cnf.fallback
  4225048      4 -rw-rw-r--   1 root     root         1174 Nov 16 01:10 /etc/mysql/my.cnf
Run Code Online (Sandbox Code Playgroud)