Monadoxin Posted October 15, 2009 Share Posted October 15, 2009 Hello, I was wondering how to best approach copying table data to another server. I want to be able to loop through all of the table's rows, and add them to the other server's database. But there may be some rows that already exist over on the other server, I would like to update those ones with the new information. I would rather not have to add grants to the other server's database tables. Multiple servers will be running this PHP script. That means there would need be a wild card IP address to connect. It wouldn't be very secure to allow anyone to connect. I am at a loss on how to proceed. Obviously I don't want raw information to be sent through the internet, so I need to do this in a secure way. I was thinking I could just encrypt the information before sending it, but I am unsure of how to send it. If anyone has any suggestions on where to start it would be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/177820-solved-copying-mysql-table-data-to-another-server/ Share on other sites More sharing options...
ialsoagree Posted October 15, 2009 Share Posted October 15, 2009 Is it possible to create a mysql connection to both databases from the same PHP script? Quote Link to comment https://forums.phpfreaks.com/topic/177820-solved-copying-mysql-table-data-to-another-server/#findComment-937622 Share on other sites More sharing options...
Philip Posted October 15, 2009 Share Posted October 15, 2009 Is this a one time action? Quote Link to comment https://forums.phpfreaks.com/topic/177820-solved-copying-mysql-table-data-to-another-server/#findComment-937640 Share on other sites More sharing options...
Monadoxin Posted October 15, 2009 Author Share Posted October 15, 2009 It is possible, but since this will be running from a lot of different servers, I would need to add GRANTS to allow those servers to connect. So I would most likely end up having to allowing any IP address to connect. It would be a lot easier, but I cannot do it this way. This will be a cron script that will be executed every day. Quote Link to comment https://forums.phpfreaks.com/topic/177820-solved-copying-mysql-table-data-to-another-server/#findComment-937641 Share on other sites More sharing options...
Philip Posted October 15, 2009 Share Posted October 15, 2009 If it's running through a bunch of scripts, why not push an single point to access the MySQL server, like an API.... where the other scripts call this single (set of) script(s) that update/insert where needed. Then create a separate MySQL user with limited permissions (such as just update/insert) on the single script's IP. That way even if that user got compromised, the least amount of damage could be done. Quote Link to comment https://forums.phpfreaks.com/topic/177820-solved-copying-mysql-table-data-to-another-server/#findComment-937646 Share on other sites More sharing options...
Monadoxin Posted October 15, 2009 Author Share Posted October 15, 2009 That sounds like a good solution. I will give it a try. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/177820-solved-copying-mysql-table-data-to-another-server/#findComment-937657 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.