Jump to content

Working with localhost DB and remote DB


Omzy

Recommended Posts

Basically I have a development environment set up on my localhost server (on my machine) so I can test new changes before uploading to the live server.

 

This means that every time I update something in my local database I have to create a sql dump, then import this in to my live database - which is rather tedious. So, I have two questions:

 

1) Is there a script I can create which sends the sql dump query (HTTP_REQUEST perhaps?) to a script on the live server, which then inserts this data in to the live database?

 

2) Can you create a sql dump query that won't overwrite data that already exists in the database, but instead just updates any data that has been changed/removed/added?

Link to comment
Share on other sites

At one point I was resigned to having my PHP scripts connect remotely to the live database, and that way I would only need to maintain one copy of the database. However I then realised my webhost (like most others) doesn't allow remote connections to the database.

 

I've now come across this article which talks about SSH tunelling:

 

http://chxo.com/be2/20040511_5667.html

 

Has anyone tried this and would this be the best option for me?

Link to comment
Share on other sites

Yes you could certainly tunnel to your remote host (assuming they let you have SSH access). I've done this method before, the problem being however that you'll still want to be working locally for any changes to data that have occured as you don't want to update live data. So in a fashion you'll still be expected to perform all the queries on the live system, be that through tunnelling.

 

The only things you should really be doing to the live system is altering the schema, so you could be better of packaging up your SQL statements into a "release" for publishing along with code. Very much like you're doing now.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.