Connect to MySQL/MariaDB from a different machine
IMPORTANT: Bitnami Native Installers do not modify the firewall configuration of your computer, therefore the MySQL ports could be open which is a significant security risk. You are strongly advised to close the MySQL ports (refer to the FAQ for more information on this).
To connect to your database server remotely using the MySQL client, follow these steps:
Windows, Mac OS X, Linux
Open port 3306 in your firewall. For example, if you are using ufw, you would run the following commands (on Linux only):
$ sudo ufw allow mysql/tcp
At the server console, edit the file installdir/mysql/my.cnf 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:
$ installdir/mysql/bin/mysql -u root -p -e "grant all privileges on *.* to 'root'@'%' identified by 'PASSWORD' with grant option";
When prompted for a password, enter the password you entered during the installation process.
Restart the database server using the graphical manager (Windows and Mac OS X) or by executing the following command at the server console (Linux):
$ sudo installdir/ctlscript.sh restart mysql
You can then connect to the database server using a command like the one below.
$ mysql -h 127.0.0.1 -P 3306 -u root -p
You will be prompted to enter the root user password. This is the same as the application password.
Mac OS X-VM
Select the “Network” tab, then click “Add”.
On the resulting dialog, enter 3306 as local and remote port. Active the “Require local” and “Over SSH” checkboxes, and click “Ok” to save your changes.
On the “Network” section, you will see an SSH tunnel to the 3306 port enabled.
If the connection is successful, click “OK” to save the connection.
You can then connect to the database server using a command like the one below.
$ mysql -h 127.0.0.1 -P 3306 -u root -p
You will be prompted to enter the root user password. This is the same as the application password.