PDA

View Full Version : PHP MYSQL Question



WebWatcher
July 22nd, 2008, 03:43
Hi,

I have two domains hosted with two different host. One with shared hosting and one on a VPS.

My question is:

Is it possible for the domain hosted on the shared hosting site to read and use a database on the VPS.
My problem is the shared hosting mysql goes down quiet a bit but the rest of the specs are what I need. Instead of changing host and going through all that hassle I just want to check if this is possible and if so how it could be done!

Thanks in advance

Decker
July 22nd, 2008, 03:55
Setup the VPS MySQL to allow remote access from the IP of your shared account and change the MySQL host from localhost (or whatever IP/hostname the shared account gave you for MySQL access) on the shared account to the IP of the VPS, should be all that's needed :)

Dynash
July 22nd, 2008, 04:15
If you have cPanel on the VPS, you can do that from the cP itself.

WebWatcher
July 22nd, 2008, 07:50
Hey Mate,

How would I get the ip address of the shared host?

Dynash
July 22nd, 2008, 08:05
http://www.hcidata.info/host2ip.htm
go to that site, enter the first Nameserver (usually ns1.host.tld), then the IP you get is the IP you will use.
do a lookup on the hostname.

WebWatcher
July 22nd, 2008, 08:28
And for the VPS i do the same thing and then instead of putting localhost I use the IP of VPS... Correct???

Dynash
July 22nd, 2008, 08:30
Yeah. to be safe too, you best put the port too. {VPS_IP}:3306 as the host.

WebWatcher
July 22nd, 2008, 08:55
Is there any security issues that may arise by doing this?

Dynash
July 22nd, 2008, 15:52
Not if you do it right, restrict access by one IP (That is yours) and only allow access to a strong mySQL username and password.