PDA

View Full Version : External Mysql Access


protocool
04-27-2003, 07:12 PM
I have got a host, which has PHP but no Mysql. Is there anyway that I can use a Mysql database hosted on another host, on the site I already have.

Can this be done by connecting to the database using its DNS IP address externally, instead of having to access the database in the same server using 'localhost'.

Thanks!

nnichols
04-27-2003, 09:10 PM
It certainly can. Just use the domain name or IP of the server you want to connect to - as long as the db user has permission to access from the external client.

protocool
04-27-2003, 09:21 PM
So not all webhosts allow external access of the database im guessing?

nnichols
04-27-2003, 09:24 PM
If you are one of many users of a db server run by a hosting company it is unlikely that they allow external access (only localhost), but it's always worth trying.

If it fails you can try asking for access, and if you are always going to be connecting from a fixed IP they might allow you.

protocool
04-27-2003, 11:07 PM
thanks!

necros
05-07-2003, 02:04 AM
Like mentioned, perfectly feasible but poor practice.
Unless the two machines are in the same data center your going to be paying bandwidth charges for your mysql data, with which if you have poorly optimised queries you'll end up with high bandwidth cost at both ends, a slow site, and not the best solution.

You should always try and get them on the same box or in the same data center (if you can get internal ip's with valid routes).