By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,614 Members | 1,662 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,614 IT Pros & Developers. It's quick & easy.

Accessing remote database with php

100+
P: 196
Hi, iv made a php script which searches and retrieve rows from a database on server A, What i want to do now is to be able to access the same database on another server (server B), the reason for this is that multiple websites will have to be able to access the database which are all on different servers.


Thanks for any information,
Sep 16 '08 #1
Share this Question
Share on Google+
5 Replies


Atli
Expert 5K+
P: 5,058
What's the problem?

All you should have to do is change the host address accordingly.
Sep 16 '08 #2

Markus
Expert 5K+
P: 6,050
What's the problem?

All you should have to do is change the host address accordingly.
Well, considering the database doesn't change (If I'm not mistaken), you should just mysql_connect().

Cheers,

Mark.
Sep 16 '08 #3

100+
P: 196
Ok i tried just the connecting it didn't work i got an error saying could not connect, couldn't find the address.

I fiddled a bit with the address trying to change it but it didn't seem to work.

for example the origional server name i used looked something like this

mysql.myservername.net (not really this)

this works locally but not on a remote server,

next i tried using the ip address that was associated witht he name for example

10.255.255.255 (not really this)

And neither option seemed to allow me to connect remotely,

Any suggestions???


Thanks for the help
Sep 17 '08 #4

Atli
Expert 5K+
P: 5,058
Are you sure the host allows remote connections?
You will need to connect as a user that has been given remote access.

It's also possible that the server's firewall blocks the port MySQL uses. (usually 3306)
Sep 17 '08 #5

100+
P: 196
That could be the case i will have to check if i can allow remote connections to the server.
Sep 18 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.