How do I connect to a database on another host?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
lexblago
Forum Newbie
Posts: 5
Joined: Thu Jun 05, 2008 8:56 am

How do I connect to a database on another host?

Post by lexblago »

Hi,

Okay, so I have two hosting services. One on GoDaddy.com and one on Ipower.com. The scripts I have running don't work on the godaddy database setup but they do with the ipower database. Hence my problem.

So, now I'm trying to figure out how I can connect to the ipower database from the godaddy scripts.

Can anyone help with this one?
User avatar
deejay
Forum Contributor
Posts: 201
Joined: Wed Jan 22, 2003 3:33 am
Location: Cornwall

Re: How do I connect to a database on another host?

Post by deejay »

i think you need to contact your hosts at ipower as they will need to set up permissions for an external connection.


Hope that helps
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: How do I connect to a database on another host?

Post by pickle »

In mysql_connect() (or whichever other function you're using), you can specify the hostname. You'll also have to set up your database to allow connections from hosts other than localhost.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
lexblago
Forum Newbie
Posts: 5
Joined: Thu Jun 05, 2008 8:56 am

Re: How do I connect to a database on another host?

Post by lexblago »

Thanks, I really appreciate the help. I actually contacted the two different hosts and neither one of them allows a remote database connection. LOL. Thats soooooo garbage! Thanks anyway!
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: How do I connect to a database on another host?

Post by VladSun »

Do they allow you to use SSH shell? If yes, then you may use SSH tunneling...
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply