Target destination for MySQl connections

I have three targets, Dev (local env), Stage (on remote server) and Live (on remote server).

I have the one DB connection in Wappler, and I have selected the Target to each one, ‘Dev’, ‘Staging’, and ‘Live’ and entered the DB settings for each.

I can see these settings stick when I switch Targets and they are correct.

However, the ‘Staging’ target still write to the Live DB, even though it have a different DB name.

Where would I be going wrong with this?

What is ‘Stag’ ?

And can you show some screenshots of your target setup + where it’s going wrong?

I have three Targets:

  1. Dev (local environment on my computer)
  2. Stage (staging environment on remote server)
  3. Live (live site on remote server).

All my Targets for files etc work properly - no issues there.

The DB Direct connections for Live and Dev, all work fine too and write/read to their correlating DBs set in the Database Connection.

However for the Staging Target (named Stage), all the files upload fine, but for some strange reason the Database Connection connects reads/writes to the Live target, and not its own DB connection as specified in the Database Connection dialogue for ‘Stage’’ target.

I have re-uploaded all the files to the staging server, but it still insists on reading/writing to the Live target’s Database instead, even though the Database connection parameters are all pointing to the Staging’s servers DB.

Image Below: Staging Target on remote server - all parameters are set for Staging DB which exists on the staging server. This for some reason reads/writes to the Live DB instead (image further below)??:

Image Below: Live Target on remote server - all parameters are set for Live DB which exists on the live server - this works fine and reads/write without issues:

Hmm a few things come to mind that you can check:

  1. I see both your staging and live target are hosted on localhost:3306? I’m using docker so it might be different for me. But it doesn’t make sense to me that your live and staging server are located at the exact same address. Shouldn’t they be on different ports?

  2. One thing to be aware of is that if you have wappler open, and set it to a certain target - it will conncet to that targets database afbeelding
    Even if you are on another target’s url.

For example: if I’m on my localhost:8100 which is where my local development is running, and I have the target in wappler on ‘live production’. Which is on an actual domain… it will connect with the live production’s database.

Thanks for the reply.

Aware of how the targets work in Wappler.

It isn’t an issue having the Stsging and Live on the same server. Staging server has its own seperate file directory username/pwd and it’s own separate database with seperate db user and password to that of the Live.

The issue here is that even though the staging server is set to a different database (with a different database name) within Wappler, Wappler still insists on connecting to the Live server database. I have double checked the staging server database connection settings and ensured that the database name points to the staging server database and not the live server. You can see this in the screenshots that I have provided.

When I am back at computer I will try to delete staging target from Wappler and set it up again.