Omzy Posted February 6, 2009 Share Posted February 6, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/144087-working-with-localhost-db-and-remote-db/ Share on other sites More sharing options...
Omzy Posted February 6, 2009 Author Share Posted February 6, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/144087-working-with-localhost-db-and-remote-db/#findComment-756042 Share on other sites More sharing options...
aschk Posted February 6, 2009 Share Posted February 6, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/144087-working-with-localhost-db-and-remote-db/#findComment-756088 Share on other sites More sharing options...
Omzy Posted February 6, 2009 Author Share Posted February 6, 2009 Right my webhost has just advised me that SSH tunelling isn't allowed on their servers... Quote Link to comment https://forums.phpfreaks.com/topic/144087-working-with-localhost-db-and-remote-db/#findComment-756366 Share on other sites More sharing options...
corbin Posted February 6, 2009 Share Posted February 6, 2009 Did they notice it and tell you to stop, or did you ask them? Forgiveness is better than permission ;p. Quote Link to comment https://forums.phpfreaks.com/topic/144087-working-with-localhost-db-and-remote-db/#findComment-756372 Share on other sites More sharing options...
Omzy Posted February 8, 2009 Author Share Posted February 8, 2009 So, any1 have any more suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/144087-working-with-localhost-db-and-remote-db/#findComment-757405 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.