Score:1

MariaDB 10.5 refusing remote connections

cn flag

I've gone through a lot of tutorials and questions and I still can't get it to work.

I installed MariaDB 10.5 on a Debian 11 server. We changed its IP address yesterday and since then we cannot do a remote connection. The database answers "Access Denied to user@host on database"

We created some users to test:

GRANT ALL PRIVILEGES ON db.* TO 'user'@'host.domain.com' IDENTIFIED BY 'something';

Does local connections work?

Yes, as we granted the privileges to localhost access.

Did you verify the users were added correctly?

I think so:

MariaDB [(none)]> SELECT User, Host FROM mysql.user WHERE Host <> 'localhost';

+--------------+------------------------+
| User         | Host                   |
+--------------+------------------------+
| user         | host.domain.com        |
| root         | 127.0.0.1              |
| root         | ::1                    |
+--------------+------------------------+
3 rows in set (0.00 sec)

Have you unblocked the firewall?

Yes, as we get Access Denied error. So we are getting into the database.

Did you check the my.cnf file for correct settings?

Incorrect settings in my.cnf (/etc/my.cnf) can cause it to refuse connections. These are skip-networking and bind-address. My file looks like this:

#
# This group is read by the client library
# Use it for option that affect all clients, but not the server
#
[client]

#
# 
#
[client-mariadb]

The server file contains the bind-address directive to allow remote connections

bind-address = 0.0.0.0

Did you check the other config files?

Yes.

Does telnet work?

Yes.

Did you remember to restart?

Yes. I restarted using this between all attempts:

service mariadb restart

We cannot find what is wrong with this server.

ua flag
Look for "flush hosts".
user10489 avatar
nc flag
get the ip of host.domain.com and make sure the host command returns that hostname when you query the ip address. If the reverse mapping doesn't give you the correct answer, the hostname won't work. Might try ip address instead.
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.