Forum Moderators: coopster

Message Too Old, No Replies

Run mySQL query on remote database

         

stevenmcconnon

11:35 pm on Jul 16, 2010 (gmt 0)

10+ Year Member



I am trying to sync 2 databases on separate servers that I own. Neither server allows remote mysql connections, so my Idea is to run the query on Server A and pass the resulting array to server B. When I try to echo a variable from server A to Server B with an include, I get nothing. Server A is the master database on godaddy.

Is there a way to make this happen?

1. I need to either connect to Server A's database
or
2. Pass an array from one server to another



Any help would be very much appreciated!

Demaestro

12:50 am on Jul 17, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Do a query and save the output to a text file in a format you can import.

Scp the file to the other server then import it.

optik

8:57 am on Jul 17, 2010 (gmt 0)

10+ Year Member



I'd honestly just change your provider, that is pretty lame.

Is the transfer part of an app, does it need to happen instantly for the app to function or can a cron job be used to update the database on regular intervals?

lammert

9:46 am on Jul 17, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi Steven, first of all Welcome to WebmasterWorld!

I am trying to sync 2 databases on separate servers that I own. Neither server allows remote mysql connections,

Are the servers that you are talking about dedicated servers, VPS systems or is it on shared hosting? There can be several reasons that your databases aren't reachable from an external connection. One is a firewall blocking at the hosting provider, the other is that the MySQL server software has not been setup to listen to TCP/IP traffic.

I would first check if it may be a MySQL configuration setting that the connections aren't possible. That can be easily corrected and is much easier to do than try to use PHP scripts to pass the data from one site to the other

stevenmcconnon

2:24 pm on Jul 17, 2010 (gmt 0)

10+ Year Member



ok all, I figured it out!

I am using a cron job to create an XML file of the master database and then comparing the two.


Thanks for the ideas!

:)

lammert

2:44 pm on Jul 17, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Good to hear you have found a solution which works for you! As you see, there are many ways to solve a problem.

mack

3:50 pm on Jul 17, 2010 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Glad you where able to resolve the issue, it would be great if your providers allowed you to set up mysql replication.

Mack.