I look for solution in my Laravel application. I have database on another server and try co connect it with my app. I am not sure how to set .env file and how to set and keep connection between servers.
I read about approach with ssh connection:
ssh -fNg -L 3307:127.0.0.1:3306 myuser@remotehost.com
mysql -h 127.0.0.1 -P 3307 -u dbuser -p db
and that works but after one day connection expires and again I have to set the connection on server. I need to keep it.
Do you have solution?