Skip to content

Connect to MySQL Addon

Overview

Apps on Cloudron use an internal MySQL database (addon). For security reasons, the database is only accessible from inside the server and cannot be accessed directly from outside. Instead, the database is accessed using an SSH tunnel to the server.

In this guide, we will see how to connect to the MySQL addon database from outside (say, your laptop/PC).

Database credentials

To get the database credentials, open the Web terminal of an app and run env | grep CLOUDRON_MYSQL. Make a note of the credentials. Note that each app has it's own separate database and thus it's own database credentials.

Internal IP Address

Next, SSH into the server and get the IP address of the internal MySQL server. You can do this by running docker inspect mysql | grep IPAddress. In the output below, 172.18.0.4 is the IP of the MySQL server. This database server IP is the same for all apps. However, it's possible that this IP changes over a Cloudron update.

#root@my:~# docker inspect mysql | grep IPAddress
            "SecondaryIPAddresses": null,
            "IPAddress": "",
                    "IPAddress": "172.18.0.4",

DB Clients

DBeaver

DBeaver is a free multi-platform database tool for developers, database administrators. You can download it here.

Create a new MySQL connection in DBeaver.

Fill up the values gathered in the steps above:

Configure SSH tunnel by clicking on the SSH tab:

You should now be able to view the database:

MySQL Workbench

MySQL Workbench is a unified visual tool for database architects, developers, and DBAs.

Create a new connection in MySQL workbench.

Select Standard TCP/IP over SSH as the connection method. Fill up the values gathered in the steps above:

You should now be able to view the database: