Score:0

debian 11 + mariadb remote connections

jp flag

I'm having trouble getting mariadb to accept remote connections on Debian 11 on a fresh installation.

I've changed bind address to bind-address: 0.0.0.0. From the same server, I can telnet into port 3306 just fine. From a remote server, I get connection refused errors or Error 2002 (115).

There is not currently a firewall running. I can telnet into other service ports just fine, but nothing with mysql. What am I missing?

Server with MariaDB

tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN

Connections from Server

telnet 192.168.0.143 3306
Trying 192.168.0.143...
Connected to 192.168.0.143.
Escape character is '^]'.
c
5.5.5-10.5.15-MariaDB-0+deb11u1#l#dQKa&9▒▒-+kZ`VmBBbFxMmysql_native_password

Connections from Client

telnet 192.168.0.143 3306
Trying 192.168.0.143...
telnet: Unable to connect to remote host: Connection refused
mysql -u user -p -h 192.168.0.143
Enter password:
ERROR 2002 (HY000): Can't connect to MySQL server on '192.168.0.143' (115)

UPDATE

I'm really at a loss for what's going on. From this box, I am able to access mysql using 127.0.0.1, 192.168.0.143 or the external IP without any issue.

When trying to connect from any other box, it's acting like it's blocked by the firewall.

  • iptables is what I generally use but i've cleared out all rules, flushed all tables, and all policies are set to accept.
  • There is no firewall running from my cloud host - verified with their support team.
  • Other services are connecting just fine externally, which would really point towards an issues specific with mariadb.

MariaDB is currently binding to app ipv4 and ipv6 interfaces. I've tried having only bind to ipv4, changing the default port to something other than 3306.

Dec 29 15:57:14 myserver systemd[1]: Starting MariaDB 10.10.2 database server...
Dec 29 15:57:14 myserver mariadbd[141636]: 2022-12-29 15:57:14 0 [Note] /usr/sbin/mariadbd (server 10.10.2-MariaDB-1:10.10.2+maria~deb11) starting as process 141636 ...
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] InnoDB: Number of transaction pools: 1
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] InnoDB: Using liburing
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] InnoDB: Completed initialization of buffer pool
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes)
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] InnoDB: 128 rollback segments are active.
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] InnoDB: log sequence number 45507; transaction id 20
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] Plugin 'FEEDBACK' is disabled.
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] InnoDB: Buffer pool(s) load completed at 221229 15:57:15
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] Server socket created on IP: '0.0.0.0'.
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] Server socket created on IP: '::'.
Dec 29 15:57:15 myserver mariadbd[141636]: 2022-12-29 15:57:15 0 [Note] /usr/sbin/mariadbd: ready for connections.
Dec 29 15:57:15 myserver mariadbd[141636]: Version: '10.10.2-MariaDB-1:10.10.2+maria~deb11'  socket: '/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
Dec 29 15:57:15 myserver systemd[1]: Started MariaDB 10.10.2 database server.
us flag
What is the network topology?
jp flag
Both server and client are cloud servers. I can telnet to other ports from client to server machine and it works fine. Mysql though just doesn't seem to answer
us flag
Have you checked the cloud network configuration for any firewall settings?
jp flag
yup - no firewalls in place. nmap reports the port as accessible, but closed.
us flag
Where exactly did you check the cloud networking configuration and firewalls?
jp flag
Verified with my cloud host there was no firewall at their level, and flushed iptables and verified all traffic is being accepted.
vidarlo avatar
ar flag
Have you tried stopping mysql and listening with something like `nc -l -p 3306` to verify that the issue is MySQL, and that there's no firewall?
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.