“Connection refused” is usually due to one of the following issues:
The server that should listen on the port isn’t running in the first place.
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.
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.
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.