skip to Main Content

my MySQL 8.0.31 database is running on port 33060 and this works well. But unfortunately, I cannot access the database from another server. When I check with

root:~#  sudo lsof -i -P -n | grep 33060
docker-pr 1226664            root    4u  IPv4 13558339      0t0  TCP 127.0.0.1:33060 (LISTEN)

I see that if listen on 127.0.0.1 but not on 0.0.0.0:33060 as expected. My config in my.cnf looks like this:

[mysqld]
bind-address=0.0.0.0

skip-host-cache
skip-name-resolve
datadir=/var/lib/mysql
socket=/var/run/mysqld/mysqld.sock
secure-file-priv=/var/lib/mysql-files
user=mysql

pid-file=/var/run/mysqld/mysqld.pid
sql-mode=""

server-id=3333333
log_bin=mysql-bin
log_error=mysql-bin.err
binlog_do_db=demo

gtid_mode                = ON
enforce-gtid-consistency = ON

ft_min_word_len=2

[client]
socket=/var/run/mysqld/mysqld.sock

!includedir /etc/mysql/conf.d/

I already try to remove bind-address or set it to different values like * or the IP address from the accessing server, but everything seems to be ignored.

I have another server with the same configuration and there it works fine. Why is bind-address is being ignored and how can I force to set the 0.0.0.0?

2

Answers


  1. Chosen as BEST ANSWER

    Meanwhile I was able to find a generic solution: simply remove the line {"ip":"127.0.0.1"} from /etc/docker/daemon.json fixes that issue.


  2. I think you configured the database network to listen on 0.0.0.0 but the docker container is listening on 127.0.0.1 (default).

    If that’s the case you should add the following flag to your docker run command

    -p 33060:33060
    

    After that when you run docker ps you should see 0.0.0.0:33060->33060/tcp on your container. Also the lsof should verify this as well.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search