Bitnami MariaDB Virtual Machine – How To Enable Port 3306 for MariaDB

Bitnami virtual machines are great for quickly enabling an environment for testing or learning.  Sometimes they can be a challenge when I want to use other software with them.

Problem:

I wanted to connect to the MariaDB database located on a Bitnami MariaDB Virtual Machine with the MySQL Workbench on my laptop’s software.

Already done to the Bitnami MariaDB Virtual Machine:

1. Using the DHCP address enabled by default on virtual machine (laziness – should set static IP address), my only configuration was enabling the network connection in my VM Workstation.

2.  Enabled the virtual machine for SSH connections for Debian, so I can make putty connections.

Instructions:  Enable or disable the SSH server – Debian

3. Out of laziness, I am using the default bitnami OS user account and the root user for the MariaDB, credentials found:

cat /home/bitnami/bitnami_credentials

Resolution:

  1.  Check netstat to see if the port is enabled for only the local server.  If you see that port 3306 is enabled only for 127.0.0.1, then only connections on that server can be made using that port.
sudo netstat -ntlup | grep mysql

2. To correct the problem above, the my.cnf file will need to be edited:

sudo vi /opt/bitnami/mariadb/conf/my.cnf

The only parameter that need to be changed is the bind_address.  Change the “127.0.0.1” to ” :: “, and this will allow any IP address to access the database (don’t do this on your production MariaDB servers, or it will fail any auditor security scans).

Then save & close the my.cnf configuration file.

3.  Set the firewall to allow connections on port 3306.

sudo ufw allow 3306

4.  Again out of laziness, I just rebooted to reset the configurations of the database & firewall.

sudo reboot

5.  Great thing about this virtual machine is that it rebooted in less than minute on my old laptop.  Then I was able to verify port 3306 was available.

sudo netstat -ntlup | grep mysql

Then I tested the connection in the MySQL Workbench successfully.

 

 

Leave a Comment