1

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.

3
  • This could be a firewall issue. Could you update your question to include the output of sudo ufw status? This will show whether you allow 43211 from one source but not the other.
    – matigo
    May 12, 2021 at 7:42
  • Sorry, I turned off ufw as a temporary troubleshooting option before everything else and so it is disabled for troubleshooting @matigo.
    – ylluminate
    May 12, 2021 at 15:22
  • Is your mysql server on a EC2 server? And does it have a policy to accept connections over 0.0.0.0:43210 ? What happens when you traceroute to 123.123.123.123 ?
    – Emmett
    May 12, 2021 at 19:00

1 Answer 1

0

Solved this issue!

It turns out that it was a bug in the local private IP assignment with Ubuntu 18.04 and the host provider, Linode. After looking into things a little deeper, even though the private IP was assigned, manually setting up Netplan instead of the pre-existing automated networking setup resolved the communications issue.

1
  • oh was that it? glad you articulated the solution clearly for other people. you should upvote yourself.
    – Aries
    Oct 9, 2023 at 23:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.