1

I have set up a MariaDB server on db.bestalbumsintheuniverse.com, port 6612. I have the following situation from the command line on my local laptop (macOS):

$ mysql -h db.bestalbumsintheuniverse.com -P 6612
ERROR 2002 (HY000): Can't connect to server on 'db.bestalbumsintheuniverse.com' (60)

$ docker run -ti maria-client mysql -u [redacted] -p[redacted] -P 6612 -h db.bestalbumsintheuniverse.com -e 'SELECT version()'
+---------------------------+
| version()                 |
+---------------------------+
| 10.6.7-MariaDB-2ubuntu1.1 |
+---------------------------+

maria-client is a docker container built using the following Dockerfile:

FROM ubuntu:22.04
RUN apt update && apt install -y mariadb-client

The server at db.bestalbumsintheuniverse.com is running Ubuntu 22.04 on Digital Ocean, with MariaDB 10.6 installed and configured to listen on all interfaces, and on port 6612. I also have UFW active and allowing TCP connections on port 6612 from anywhere. The networking works (as evidenced by the fact that the connection from the Docker container works).

Here are some relevant version strings:

mysql (MariaDB) on the laptop:

$ mysql --version
mysql  Ver 15.1 Distrib 10.6.10-MariaDB, for osx10.17 (x86_64) using  EditLine wrapper

mysql (MariaDB) in the docker container on the laptop:

$ docker run -ti maria-client mysql --version
mysql  Ver 15.1 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) using  EditLine wrapper

server MariaDB:

$ mysqld --version
mysqld  Ver 10.6.7-MariaDB-2ubuntu1.1 for debian-linux-gnu on x86_64 (Ubuntu 22.04)

I've been going at this as if it's a version mismatch issue, because I've encountered connectivity problems with MariaDB and version mismatches before.

Clearly the problem is not network connectivity, since I can connect using the Docker containerized mariadb, right? So why can I connect from the Docker container on macOS but not the native mysql (MariaDB) client on the same device?

8
  • 1
    I've updated the question to make it clear that connections from the maria-client Docker container do, in fact, work fine. It was probably confusing that the original post had that command returning an error.
    – audiodude
    Commented Nov 11, 2022 at 6:01
  • Also telnet says this: $ telnet db.bestalbumsintheuniverse.com 6612 Trying 164.92.127.60... Connected to db.bestalbumsintheuniverse.com. Escape character is '^]'. 5.5.5-10.6.7-MariaDB-2ubuntu1.1-qy,kZQW��@wZ<[7@zhxC$mysql_native_password
    – audiodude
    Commented Nov 11, 2022 at 6:04
  • 1
    I think the garbled characters are just a result of the fact that MariaDB is using a binary protocol on port 6612. I am in fact setting the password directly on the command line with -pmypassword, no space
    – audiodude
    Commented Nov 11, 2022 at 20:20
  • 1
    Also the password is all ASCII characters.
    – audiodude
    Commented Nov 11, 2022 at 20:39
  • Can you do a nc -vz db.bestalbumsintheuniverse.com 6612 from your Mac?
    – Sathyajith Bhat
    Commented Nov 11, 2022 at 23:48

1 Answer 1

0

I was at an AirBnB (not my home network) and this cleared up once I was back on my own network. Must have been some odd network config (though I still don't understand why it worked from the Docker container on the same machine).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .