When doing this it is important to understand some of the concepts involved. I love Laravel Forge, and also love the freedom of using Navicat for database access. Between the two it is very powerful and fast to get access to the database.
We don’t directly connect with the database from Navicat. So what we will be doing is setting up ssh access through Navicat.
Firstly you will need to go into your command line program, personally I love to use Mobaxterm. From here you will need to use the ssh-keygen command.
After this you will have the files in the directory you have created them in. It would look something like this.
You can now put the .pub file into a text editor and copy the text. I personally like notepad++ as it is fast and powerful. It will look something like that. Copy the text form the public key.
After this you can add the public key to your forge server. From the server you can click on ssh keys on the left hand side. Then add the public key and give it a name.
After this you should go into your sites, can copy the ip address at the top of the screen (simply click the copy button).
Now go into Navicat, and add a new connection. Name the connection, leave the host name/ip address as localhost. We do this because we are using a tunnel which means we will be accessing the database from inside the server rather than externally. We do this after accessing the server via ssh. That step to come next.
Next click over to the ssh tab and click on the “Use SSH Tunnel” checkbox. Now paste the ip address into Host Name/IP Address field. In the User Name field put in forge or if you have set up another user then use that one in there. Change authentication method to public key. Click the button to find the private key (the one without an extension) and put it in that field. Then test connection. If all has gone well, you will get the “Connection Successful” notice. Click OK and you are done.