Owncloud docker has no connection to mysql host

owncloud
mysql

#1

After update to UCS 4.3 and to owncloud 10, owncloud has no connection to mariadb.

Log of the owncloud dockerdocker logs ba7b3e93c2f3:

wait-for-it: waiting 180 seconds for 172.17.42.1:3306
wait-for-it: timeout occurred after waiting 180 seconds for 172.17.42.1:3306

The host has also no connection telnet 172.17.42.1 3306

Trying 172.17.42.1...
telnet: Unable to connect to remote host: Connection refused

But to 127.0.0.1 3306 its connected.

How can the owncloud docker connects the host db?


#2

Hey,

“Connection refused” is usually due to one of the following issues:

  1. The server that should listen on the port isn’t running in the first place.
  2. The server is running, but it is configured to listen on some IP addresses only, but not on the one you’re trying to connect to.
  3. Firewall rules prohibit the connection with action REJECT (action DROP would lead to a different error message: “connection timed out”).

Therefore verify those three things in order. First make sure MariaDB is running. Next look which ports it is listening on, e.g.:

[0 root@backup2 ~] lsof -PniTCP:3306 -sTCP:LISTEN
COMMAND  PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
mysqld  1383 mysql   19u  IPv4  24616      0t0  TCP *:3306 (LISTEN)

The …TCP *:3306… means that my daemon is listening on all IP addresses. Other common patters are …TCP 127.0.0.1:3306…, which would mean that it is only listening on the local-loopback interface.

Last check your firewall setup if both prior tests indicate that things should work.

Kind regards,
mosu


#3

That was the output of the lsof command. The Problem was a false Symlink of /etc/alternatives/my.cnf -> /etc/mysql/my.cnf.migrated, that contains a loopback binding. I set my.cnf to /etc/mysql/mariadb.cnf, which bind to 0.0.0.0.

Many Thanks.
jo