Remote connection to MariaDB

How do I connect remotely (for example, using HeidiSQL) to the MariaDB database with db_user_name and password (not root)?
I set
bind-address = *
in /etc/mysql/my. cnf - it doesn’t help. Disabled iptables and fail2ban-also did not help.
What else can I see?

Hello Maxim, try this instead:

[mysqld]
...
bind-address = 0.0.0.0

Afterwards you can confirm with

sudo netstat -ntlp | grep -E "(mysql|maria)"

[mysqld]

bind-address = 0.0.0.0
it doesn’t help

sudo netstat -ntlp | grep -E “(mysql|maria)”
netstat: command not found

apt install netstat cowsay && echo “now I have netstat installed” | cowsay

netstat -ntlp | grep -E "(mysql|maria)"
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      96676/mariadbd

But not connecting.

telnet 123.123.123.123 3306 - say “Could not open a connection to this node, on port 3306”

What else to pay attention to?

"Could not open a connection to this node, on port 3306” it’s a great tip for your question.

how will this help me? what should I do?

Did you restarted the mysql service after changing the conf?

of course

I think the output of the netstat command is showing that mariadb service is listening on localhost only (127.0.0.1).
Have a look at the bold in this StackOverflow answer. Maybe it’s related.

1 Like

I realized what the problem was.
I set bind =0.0.0.0 in the Hestia panel itself in the mariadb config settings.
And it was necessary to change this value in the file /etc/mysql/mariadb.conf.d/50-server.cnf.
And now question: why are the mariadb config settings ignored in the hestia panel?

In the /etc/mysql/mariadb.conf.d/50-server.cnf file i set
bind-address = 0.0.0.0
And the remote connection to the database works.
But why can’t I connect remotely if I set my IP?
bind-address = 123.123.123.123

Because its probaly a different config file. I usualy always suggest to adjust them on shell instead web, it just makes more sense. About the request itself, this has added a while ago to our docs: Database — Hestia Control Panel documentation

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.