代码之家  ›  专栏  ›  技术社区  ›  ZhaoGang

Ubuntu上Docker中的MySQL:警告:忽略世界可写配置文件

  •  1
  • ZhaoGang  · 技术社区  · 6 年前

    在我的 /etc/mysql/my.cnf ,我有: !includedir /etc/mysql/mysql.conf.d 配置好了,我认为 my.cnf 在我的 !includedir 目录应该覆盖 /etc/mysql/my.cnf ,根据 https://dev.mysql.com/doc/refman/8.0/en/option-files.html .

    但我有一个 World-writable config file /etc/mysql/mysql.conf.d/my.cnf is ignored 重新启动mysql服务器时发出警告,并确认 在我的 不起作用。为什么会发出警告,以及如何使其生效?

    背景:

    Ubuntu 16.04.3在Docker中,mysql 5.7.22

    注:

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

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

    2 回复  |  直到 6 年前
        1
  •  1
  •   danblack    6 年前

    请您的管理员修复权限,可以:

    $ 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
    
        2
  •  1
  •   ZhaoGang    6 年前

    world writable 配置文件将被忽略。我真的应该仔细阅读这些信息。

        3
  •  1
  •   James Bond    4 年前

    将权限更改为0444:

    chmod 0444 my.cnf

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

    volumes:
        # Set mysql extra config:
        - my.cnf:/etc/mysql/conf.d/my.cnf
    
        4
  •  -2
  •   Ramajayam Gopi    3 年前

    root@c70ab714446b:/#chmod 0444/etc/mysql/mysql.cnf