null,来自服务器的消息:主机“172.17.0.1”不允许连接到此 MySQL 服务器

null,来自服务器的消息:主机“172.17.0.1”不允许连接到此 MySQL 服务器

我使用的是 Acer Aspire 5738,8GB 内存,16GB 交换空间,安装了 Pop!_OS。我使用 DBeaver 作为 RDBMS 客户端,并为 3 个数据库映像 sqlserver、mysql 和 postgresql 创建了 3 个容器和 3 个单独的卷(用于保存数据)。

Sqlserver 和 Postgresql 在 DBeaver 中都可以正常连接,但 MySql 除外,它返回以下错误:

null,  message from server: "Host '172.17.0.1' is not allowed to connect to this MySQL server"

docker ps -a

下载的图像是: 数据库图像

创建的卷为: 已创建的卷

我不知道我做错了什么,但这个问题仅存在于 MySQL 中。另外,在第一个屏幕截图中,我看到mysqlserver容器被映射到额外的端口 33060-33061/TCP

另一件事是,我无法my.cnf在任何地方找到该文件,无论是在/etc/mysql/my.cnf还是在/etc/my.cnf但当我使用终端上的 bash 检查 mysql 映像文件时,我可以在里面看到它

我的cnf

我的目标是创建这 3 个容器,然后将这 3 个容器合并到另一个(新)容器中,该容器将以某种方式启动这 3 个容器。有人可以逐步指导我如何实现这一点以及如何纠正上述错误吗?

请注意: 我能够从 bash 终端连接到 MySQL。

编辑: MySQL 的 DBeaver 客户端错误

编辑: 安装了 MySQL-Client 并连接时出现错误...

编辑:

root@pop-os:/# docker ps -a
CONTAINER ID   IMAGE                                        COMMAND                  CREATED        STATUS          PORTS                                                  NAMES
d162d3ea474d   mysql                                        "docker-entrypoint.s…"   2 hours ago    Up 10 minutes   0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp   mysqlserver
825c037dd48a   postgres                                     "docker-entrypoint.s…"   22 hours ago   Up 5 hours      0.0.0.0:5432->5432/tcp, :::5432->5432/tcp              postgresql
4b3ceef37322   mcr.microsoft.com/mssql/server:2019-latest   "/opt/mssql/bin/perm…"   2 weeks ago    Up 5 hours      0.0.0.0:1433->1433/tcp, :::1433->1433/tcp              sqlserver
root@pop-os:/# docker inspect d162d3ea474d
[
    {
        "Id": "d162d3ea474d7ace1922632d7d750489ac96b214dc9655d6494aa20cb1dd6ef6",
        "Created": "2022-08-28T10:56:30.936144902Z",
        "Path": "docker-entrypoint.sh",
        "Args": [
            "mysqld"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 34285,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2022-08-28T12:19:02.950369685Z",
            "FinishedAt": "2022-08-28T12:19:00.705216809Z"
        },
        "Image": "sha256:70325c69f1fe76e7f4e62e62fb5ef4e76acb45935075cec7b4cb42a928fef78a",
        "ResolvConfPath": "/var/lib/docker/containers/d162d3ea474d7ace1922632d7d750489ac96b214dc9655d6494aa20cb1dd6ef6/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/d162d3ea474d7ace1922632d7d750489ac96b214dc9655d6494aa20cb1dd6ef6/hostname",
        "HostsPath": "/var/lib/docker/containers/d162d3ea474d7ace1922632d7d750489ac96b214dc9655d6494aa20cb1dd6ef6/hosts",
        "LogPath": "/var/lib/docker/containers/d162d3ea474d7ace1922632d7d750489ac96b214dc9655d6494aa20cb1dd6ef6/d162d3ea474d7ace1922632d7d750489ac96b214dc9655d6494aa20cb1dd6ef6-json.log",
        "Name": "/mysqlserver",
        "RestartCount": 0,
        "Driver": "devicemapper",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "docker-default",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": [
                "mysql_vol:/var/lib/mysql/"
            ],
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": {
                "3306/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "3306"
                    }
                ]
            },
            "RestartPolicy": {
                "Name": "no",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": null,
            "CapDrop": null,
            "CgroupnsMode": "private",
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "private",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "ConsoleSize": [
                0,
                0
            ],
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": [],
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": [],
            "DeviceCgroupRules": null,
            "DeviceRequests": null,
            "KernelMemory": 0,
            "KernelMemoryTCP": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": null,
            "PidsLimit": null,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "MaskedPaths": [
                "/proc/asound",
                "/proc/acpi",
                "/proc/kcore",
                "/proc/keys",
                "/proc/latency_stats",
                "/proc/timer_list",
                "/proc/timer_stats",
                "/proc/sched_debug",
                "/proc/scsi",
                "/sys/firmware"
            ],
            "ReadonlyPaths": [
                "/proc/bus",
                "/proc/fs",
                "/proc/irq",
                "/proc/sys",
                "/proc/sysrq-trigger"
            ]
        },
        "GraphDriver": {
            "Data": {
                "DeviceId": "76",
                "DeviceName": "docker-8:1-4718891-1322cdb5a68425cace5b151c72f64b006c7defc7a015d5077c84ce263d5cbafc",
                "DeviceSize": "10737418240"
            },
            "Name": "devicemapper"
        },
        "Mounts": [
            {
                "Type": "volume",
                "Name": "mysql_vol",
                "Source": "/var/lib/docker/volumes/mysql_vol/_data",
                "Destination": "/var/lib/mysql",
                "Driver": "local",
                "Mode": "z",
                "RW": true,
                "Propagation": ""
            }
        ],
        "Config": {
            "Hostname": "xxxx",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "3306/tcp": {},
                "33060/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "MYSQL_ROOT_PASSWORD=xxxx",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "GOSU_VERSION=1.14",
                "MYSQL_MAJOR=8.0",
                "MYSQL_VERSION=8.0.30-1.el8",
                "MYSQL_SHELL_VERSION=8.0.30-1.el8"
            ],
            "Cmd": [
                "mysqld"
            ],
            "Image": "mysql",
            "Volumes": {
                "/var/lib/mysql": {}
            },
            "WorkingDir": "",
            "Entrypoint": [
                "docker-entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": {}
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "8eddab3ef3e3cf04831bd3676ba2ec90aa08d95bdc3014eccb58e674e190a809",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "3306/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "3306"
                    },
                    {
                        "HostIp": "::",
                        "HostPort": "3306"
                    }
                ],
                "33060/tcp": null
            },
            "SandboxKey": "/var/run/docker/netns/8eddab3ef3e3",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "c28251bbd8cd9bc3446106dc316c2f4a596368d13968746df35e0d0e920bca97",
            "Gateway": "172.17.0.1",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "172.17.0.2",
            "IPPrefixLen": 16,
            "IPv6Gateway": "",
            "MacAddress": "02:42:ac:11:00:02",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "7d5954a7f15ccb4542bedae1f23158ff06e81f0ba5b4ac0f7d058743ba257392",
                    "EndpointID": "c28251bbd8cd9bc3446106dc316c2f4a596368d13968746df35e0d0e920bca97",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.2",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:11:00:02",
                    "DriverOpts": null
                }
            }
        }
    }
]

相关内容