How to connect MariaDB in Bold BI if the server is not reachable?
If MariaDB and Bold BI are installed on separate machines, the MariaDB server must be made publicly accessible in order to connect it to Bold BI. It’s important to note that making your MariaDB server publicly accessible comes with significant security risks. You should ensure that your server is properly secured with firewalls, strong passwords, and other security measures before proceeding.
Here are the steps to make your MariaDB server publicly accessible:
- Edit MariaDB Configuration:
- Open the MariaDB configuration file located at
/etc/mysql/mariadb.conf.d/50-server.cnf
or a similar location depending on your installation. - Locate the
bind-address
directive. It may look something like thisbind-address = 127.0.0.1
- Comment out the
bind-address
directive by adding a#
at the beginning of the line to disable it, or change it tobind-address = 0.0.0.0
to allow connections from any IP address. - Save and close the file.
- Open the MariaDB configuration file located at
Please be extremely careful with these changes, as exposing your database server to the internet can make it a target for attacks. The bind-address was set to 0.0.0.0 for the purpose of explanation… Always ensure that you’ve taken the necessary security precautions.
-
Restart MariaDB:
- Run the following command to restart the MariaDB service:
sudo systemctl restart mariadb
- Run the following command to restart the MariaDB service:
-
Create a User for Remote Access:
-
Log in to the MariaDB shell as the root user or another user with administrative privileges.
-
Create a new user and grant them privileges. Replace
your_username
,host_ip_addr
, andyour_password
with appropriate values.CREATE USER 'your_username'@'host_ip_addr' IDENTIFIED BY 'your_password'; GRANT ALL PRIVILEGES ON *.* TO 'your_username'@'host_ip_addr' WITH GRANT OPTION; FLUSH PRIVILEGES;
Here,
host_ip_addr
should be the public IP address from which you’ll be connecting or ‘%’ to allow from any IP address.
-
-
Test the Connection:
- Try connecting to the MariaDB server from the remote location using the command:
Replacemysql -u your_username -h your_server_ip -p
your_server_ip
with the IP address of the server where MariaDB is running.
- Try connecting to the MariaDB server from the remote location using the command:
-
Secure Your Server (Important):
- Implement firewall rules to allow traffic only from specific IP addresses.
- Use strong passwords and consider using SSL for connections.
- Regularly update MariaDB and the operating system to patch security vulnerabilities.
-
Connect from Bold BI:
- After ensuring that you can connect to MariaDB remotely, use the
host_ip_addr
and the credentials of the user you created to connect MariaDB from Bold BI.
- After ensuring that you can connect to MariaDB remotely, use the