1

I tried using Andrew Welch's craft-connect plugin, but the plugin was throwing an error on the REMOTE_DB_SERVER variable. I commented the variable out in the .env file, but I still could not connect. I also tried just using the IP address of the remote server in the DB_SERVER variable.

What I hope to accomplish is a shared development DB which exists on a remote server. I can then connect both of my local environments to that development DB. When I know that the development DB is good to go, I will synch it with my production DB. But, I cannot sort out how to accomplish a remote DB connection with CraftCMS.

I can connect to my development DB using the SSH method in SequelPro (requires SSH host IP, SSH user and SSH password). I've tried replacing the DB server variable with the IP address of my server in my .env file, but that doesn't work. If I'm tunneling into the server using SSH first in SequelPro, wouldn't I also need to do the same with my connection in Craft?

1 Answer 1

2

Probably the database doesn't listen for connections from the outside world. So yeah you'd need some kind of an ssh tunnel to connect to it. I think you may find, though, that doing development via a remote db can be pretty slow; check out Database & Asset Syncing Between Environments in Craft CMS

3
  • Thanks for this answer Andrew. I have been using your craft-scripts to synch and it has been working well. The issue I've been trying to solve for is that I move around in my house frequently. When I'm bored with developing in my office, I pick up my laptop and go elsewhere in the house or to the coffee shop. I've been trying to come up with an easier way of dealing with the disparity between my dev environments caused by two different local databases. Anyway, the workflows you outlined and the craft-scripts are a workable solution for me. Commented Dec 29, 2018 at 1:02
  • 1
    Craft 3.1's Project Config will help with the schema side of things, anyway. Commented Dec 29, 2018 at 2:59
  • Shameless plug: We (fortrabbit) developed Craft Copy that helps our clients to up/down database local/remote quickly. Connecting to a remote database is slow and dangerous. Commented Sep 21, 2022 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.