Hello everyone!

I have problems since the last update to connect to Maria-DB from external services.

Created a docker-compose.override.yml and add this code:

mysql-mailcow:
ports:
- 3306:3306

From localhost (docker host) I can connect to Maria-DB (tested with e.g. telnet localhost 3306).

From another host (10.10.10.1) connect to the docker host (mailcow host) direct to ip in the same network (_ e.g. telnet 10.10.10.2 3306_) I have no connection, nothing comes back:-(.

Before I installed the last mailcow update this config works fine.

Now I have tested, if I removed this code here from docker-compose.yml I can connect to Maria-DB host and everything is working fine. BUT WHY? Is the network mailcow-network restricted?

networks:
mailcow-network:
aliases:
- mysql

The funny thing, without any other config I can connect to IMAP, SMTP from the other host (10.10.10.1). Firewall between the hosts are off.

I have a second test (started with docker run) some Maria-DB like this here:

docker run --detach --name some-mariadb --env MARIADB_ROOT_PASSWORD=my-secret-pw -p 444:3306 mariadb:10.5

To this instance mariadb I can connect without any problem from other host. I think it some config from mailcow.

Any ideas thank you for every help!!!

2 months later

Have something to say?

Join the community by quickly registering to participate in this discussion. We'd like to see you joining our great moo-community!

What’s the output of

netstat -tulpen | grep 3306

? Normally it’s listening only on 127.0.0.1, so you won’t be able to connect from another host in your network

5 months later

Thanks for the answer, but how to change this? How to connect the database from another on the network.

It did not.
We finally gain some success, I will explain later.

Just tried it with my testcow:

root@testcow:/opt/mailcow-dockerized# netstat -tulpen | grep 13306
tcp        0      0 127.0.0.1:13306         0.0.0.0:*               LISTEN      0          24838      2435/docker-proxy   

Change SQL_PORT to SQL_PORT=13306 in mailcow.conf

root@testcow:/opt/mailcow-dockerized# grep 13306 mailcow.conf 
SQL_PORT=13306

Restart stack:

docker compose down
docker compose up -d
root@testcow:/opt/mailcow-dockerized# netstat -tulpen | grep 13306
tcp        0      0 0.0.0.0:13306           0.0.0.0:*               LISTEN      0          53786      10206/docker-proxy  
tcp6       0      0 :::13306                :::*                    LISTEN      0          53798      10216/docker-proxy 

Works like a charm for me

24 days later

Hey,
I am experiencing the same issue as described. I have set the SQL port in .conf & .env to 13306, and when I check with netstat & docker ps, it shows 0.0.0.0:13306, indicating that the service should be accessible. However, I can only connect locally and am unable to establish a connection from external pc. Telnet run into timeout.
Thanks in advance for any help or suggestions!

    Well, I don’t know if it can help, but here is what we have done.

    • first I installed dbeaver in a container: this is cloudbeaver, to try to connect on the same computer, to the MariaDB database, to be sure at least this first step was working (and it was)
    • then we defined this env var “MAILCOW_REPLICA_IP” withe the IP of the computer we want to connect. We done this for containers netfilter & dovecot
    • finally we defined MYSQL_ROOT_HOST=% for the mysql container

    Then on my postgresql database I defined a Foreign Data Wrapper to connect the MariaDB database. It was a bit difficult because of few definitions but if you need I can explain what I have done.

    Philidinator Do you have a firewall in have on your mailcow server? You need to open port 13306 in it as well.

    Btw, it’s generally a bad idea to open up your database port to the Internet… what exactly is it you want to achieve? If you want to connect to the database from another PC, why not using port forwarding via ssh?

      DocFraggle

      No idea, my admin system done this for me, the port is not open to the whole internet but managed to accept one IP adsress.

      What I want to achieve : use a Foreign Data Wrapper with Postgres.
      Why :

      • I manage observability and use Grafana. I have a huge amount of servers and database to manage. With FDW I can have only one datasource in Grafana to grab information from hundreds of databases
      • Having access to the databases in mailcow I can compare the number of mailboxes in the Prod with the replication. I can compare the number of messages, get some information about the satus of thez syncjobs
        With Grafana I can build alerts if something seems wrong, ie syncjob fail, if a mailbox is near the quota etc…

      Yeeah, it works great with ssh! Thank you

      No one is typing