Connect To MariaDB From A Different Machine

To connect to your database server remotely using the MariaDB client, follow these steps:

NOTE: Ensure that your virtual machine has a local network IP address. To configure your virtual machine to connect to your local network, refer to these instructions. Once connected, you can obtain the IP address of your virtual machine at any time by running the command ifconfig -a in the virtual machine server console.

  • Log in to your virtual machine console.
  • Open port 3306 in the server firewall.
  • Edit the MariaDB configuration file and find the line containing:
  •   bind-address=127.0.0.1
  • Comment out this line by placing a hash (#) symbol at the beginning, so that it looks like this:
  •   #bind-address=127.0.0.1
  • Save the file.


At the server console, allow remote access to the database server using the command line client. Use the following command, remembering to replace PASSWORD with the application password from the first step:

/mariadb/bin/mariadb -u root -p -e "grant all privileges on *.* to 'root'@'%' identified by 'PASSWORD' with grant option";

When prompted for a password, enter the default password bitnami. In case you have changed the default password, enter the new password.

Restart the server:

sudo /opt/bitnami/ctlscript.sh restart mariadb

Was this article helpful?