Published Site - How Are Database Connections Updated?

My local setup is with wamp, as my Windows 10 laptop does not support Docker Desktop.

I’ve Published my site to a remote server, and all the PHP files have arrived safely. But I assume that my Database Connection server action steps are still pointing to my local mysql server.

How can I have those automatically update to point to the remote mysql database when I publish the site?

Best wishes,

Antony.

Hey Antony,

If you have the option of using the same credentials for both db servers, you may not have to do anything. If you set the server to localhost then “local” will mean the server where it is running.

2 Likes

Database settings per target has been discussed before and I thought it was on the roadmap but it has yet to appear and to me is a significant omission

2 Likes

Hey @mebeingken, thanks for that idea… I think I will have to pay for a new hosting setup to make that work though unfortunately… :frowning:

@George, is database settings per target something that can be added? It feels like a very fundamental feature to me! :slight_smile:

Why is that Antony? Usually you can create a database (same name as local) and create a user with access to that db (same as local) and set a password for the user (again, same as the local value.) If you are not able to do that, then yes, a problem. :slight_smile:

I personally deal with this by using git and removing the connection files from the repository so they can manually be added (one time) to the file structure at each location.

If not using git, I wonder if you could just change the permissions of the files to read only at each target? Haven’t tried that, but maybe it could be done.

To keep the costs down during development I am using hosting from an old web site I own, and their ability to name things is very limited… and I want a staging and production site as well as local… I’ve spent ages on chat with their support today!

I use MAMP Pro server for my staging target. Low one time cost. Host as many staging projects as I want.

So I have three copies …

1: Local files that are also backed up in real time to OneDrive
2: Staging server using MAMP Pro
3: Production server with my hosting service provider