The only way to access your database remotely from another server or computer is by first setting up a SSH tunnel to your Templ site.

Set up SSH tunnel

Setting up the SSH tunnel between your Templ site and remote is can be done with the following command.

ssh -p PORT USER@IPADDRESS -L127.0.0.1:3306:/var/run/mysqld/mysqld.sock

Execute the above command from your remote server or computer. Be sure to replace PORT, USER and IP ADDRESS with the real credentials that you find on your Site details page in the Templ Panel.

Accessing Database

Once the SSH tunnel has been set up, then the database can be accessed on port 3306 like this (in a new terminal window):

mysql --host=127.0.0.1 --port=3306 -u USER

Note: If you already have a database set up that is using port 3306 then you will need to create the SSH tunnel on a different port and use that port instead, like port 3307.

Guide: Connect to Database with Sequel Pro

Coming soon!

Did this answer your question?