# Is it possible to access mysql DB from another server?



## elf0024 (Sep 21, 2007)

Hi everyone,

I'm quite wondering if I could access the mysql DB from another server in PHP.
Let's say my website is abc.com and another website is xyz.com
I would like to know if I can access xyz.com's DB from abc.com's php script (assume I have been accepted to be able to access its DB by xyz.com's owner) and update tables.
Wow I'm not attempting to hack or want to know the way of hacking. :
I want to make a website and offering a service, but it needs to connect to customer's DB from my server.

Anyone has any ideas??? :up::up:


----------



## Sequal7 (Apr 15, 2001)

It would depend on whether the database accepts tcp/ip connections and has a defined IP address. Most do not so it may not be possible.


----------



## tomdkat (May 6, 2006)

elf0024 said:


> I want to make a website and offering a service, but it needs to connect to customer's DB from my server.


Sequal7 is right. Since your customer would have the MySQL database to which you would need to connect, you would have to inform your customer of the requirement of configuring their database to allow the remote connection from your server. If they can make that happen, you should be able to connect just fine. 

Peace...


----------



## elf0024 (Sep 21, 2007)

Thanks guys!
I might have to find more information


----------



## Mudley (Apr 7, 2008)

its pretty easy to configure if the server has cpanel


----------



## elf0024 (Sep 21, 2007)

Thanks Mudley,

How could I do that on cPanel??

Could you please let me know??
And if I do that, is there any security issues??

Thanks a lot!


----------



## Mudley (Apr 7, 2008)

if its enabled on the server (and in cpanel), there will be a Remote Database Access Hosts section 
the icon should appear with the other database icons

i think in older versions of cpanel the remote hosts was actually on the mysql db/user page...but i can't remember

adding a remote host is as simple as adding the IP of the server (the one that needs access) 

as far as security, yeah, its a risk - especially if the server doing the accessing is a shared server
don't get me wrong though, its not an easy in...but it does create one more means of entry

my server has it enabled for MY ip


----------

