HestiaCP includes a MySQL database server, specifically MariaDB, which you can manage from the panel itself. It also includes phpMyAdmin for remote access to databases, but remote connections using a MySQL client are not possible by default.
As a general rule, a MySQL server does not listen for remote connections by default, and HestiaCP is no exception. To enable this, you will need to modify the MariaDB configuration and allow traffic through the firewalls.
This article explains how to do this quickly, without filtering by address. However, for security, we recommend setting up address filtering by IP in the firewall so that only legitimate connections can be established.
MariaDB configuration
First, modify the MariaDB configuration, specifically the bind-address line, so that it listens for remote connections as well as local ones. To do this, you can run sed directly to replace the default configuration:
# sed -i "/127.0.0.1/c\bind-address = 0.0.0.0" /etc/mysql/mariadb.conf.d/50-server.cnfNext, load the new configuration by restarting the service. To do this, run the following:
# systemctl restart mysql.serviceThe MySQL process should now be listening for remote connections. To check this, run:
# ss -tulpn | grep 0.0.0.0:3306 | wc -lIf the result is one, the check is successful.
Firewall configuration
To allow traffic on the MySQL port, add a rule to the HestiaCP firewall from the panel or via the CLI (as the root user over SSH):
# v-add-firewall-rule ACCEPT 0.0.0.0/0 3306You will also need to create a rule in the profile for the Firewall in Clouding assigned to the server so that traffic is not blocked. You can add the rule as follows from the Firewall tab in the Clouding panel:
Remember, however, that at this point we recommend filtering by IP address using /32 in "IP de Origen".
We hope this tutorial has helped you 🙂. Remember, if you have any questions about this or any other issue related to your Clouding servers, feel free to email soporte@clouding.io We're here for whatever you need!