My MariaDB server accepts connections at port 43210
without problems on the public IP address of, we'll say, 123.123.123.123
on eth0
. This is on an Ubuntu 18.04 server that also has 192.168.1.10
configured for eth0
.
I have a user configured to with permissions for all hosts (%
):
+------------------+-----------+
| user | host |
+------------------+-----------+
| myuser | % |
...
From a remote server (another host that is on the same LAN) I can connect to the public IP address of this MariaDB server:
$ mysql --user=myuser -pMYPASSWORD --host=123.123.123.123 --port=43210 mydatabase
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 340
Server version: 10.2.31-MariaDB-1:10.2.31+maria~bionic-log mariadb.org binary distribution
...
However, the problem is that when I try to connect to the LAN IP address, mysql
times out:
$ mysql --user=myuser -pMYPASSWORD --host=192.168.1.10 --port=43210 mydatabase
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.1.10' (110 "Connection timed out")
Just to verify, netstat -tlpn | grep mysql
shows it is listening on 0.0.0.0
which should be listening on all interfaces (I believe including the local IP):
tcp 0 0 0.0.0.0:43210 0.0.0.0:* LISTEN 964/mysqld
I also run PostgreSQL on this same server with MariaDB and if I connect remotely from the same other test host from which I'm trying to make the mysql connection, it connects without a problem:
$ pg_isready -d mydb -h 192.168.1.10 -p 43211 -U myuser
192.168.1.10:43211 - accepting connections
The point of the last note about PGSQL is that I just want to clarify that connections are able to get through to the actual Linux server itself, just not MariaDB.
I have also disabled the UFW
firewall temporarily in order to keep that out of the equation.
What could be going wrong here? What can I test further to isolate the problem?
I suspect that perhaps the bind-address = 0.0.0.0
in /etc/mysql/mariadb.conf.d/50-server.cnf
may be the problem, but I thought that the quadruple 0 was in fact able to handle this.
sudo ufw status
? This will show whether you allow 43211 from one source but not the other.ufw
as a temporary troubleshooting option before everything else and so it is disabled for troubleshooting @matigo.