NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Website A using database of Website B ?

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
5 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 03-22-2007, 03:39 AM THREAD STARTER               #1 (permalink)
NamePros Member
 
TotalDesain's Avatar
Join Date: Jul 2004
Location: just go to left side from my right neighbour...
Posts: 32
TotalDesain is an unknown quantity at this point
 



Website A using database of Website B ?


I had 2 webs in different hosting places.
How to connecting php script in website A to using database in website B?
__________________
Free PAD Maker | Bot Maker Tool
TotalDesain is offline  
Old 03-22-2007, 03:37 PM   #2 (permalink)
cef
NamePros Regular
Join Date: May 2004
Location: NYC
Posts: 236
cef is a jewel in the roughcef is a jewel in the roughcef is a jewel in the rough
 


Animal Rescue
It's kinda tedious and it varies based on the database system involved (Postgres is different from mysql is different from Oracle, etc.) but here's the rough process for mysql:
????: NamePros.com http://www.namepros.com/programming/308004-website-a-using-database-website-b.html

1. The database on website B must be configured to allow external connections. With mysql, for example, you need to COMMENT OUT this line in my.cnf:

#skip-networking

And you then need to set external access permissions in the database using the GRANT command. This can be complicated, based on who you're logging in as, what IPs you want to allow, etc. Here's an example line, that allows user "root" to access the system from any IP:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'

2. Make sure that the port on which the database listens (3306 by default for mysql) is open on any firewall on both websites B and A.

4. You can now connect as normal, but instead of using "localhost" as your host string, you'd use "somesite.com" or even just the IP address if you want.

Note that if you want to use a specific hostname ONLY for the database (like db.somesite.com) you'll need to set up a DNS entry for it on website B.
cef is offline  
Old 03-23-2007, 06:49 AM   #3 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,074
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
Just a note to add what cef said. If the servers are on different networks you will most likely experience slowness on site A as all data is travelling over the network
Peter is offline  
Old 03-23-2007, 08:10 AM   #4 (permalink)
Forum Moderator
 
enlytend's Avatar
Join Date: Aug 2006
Location: USA
Posts: 2,152
enlytend has a reputation beyond reputeenlytend has a reputation beyond reputeenlytend has a reputation beyond reputeenlytend has a reputation beyond reputeenlytend has a reputation beyond reputeenlytend has a reputation beyond reputeenlytend has a reputation beyond reputeenlytend has a reputation beyond reputeenlytend has a reputation beyond reputeenlytend has a reputation beyond reputeenlytend has a reputation beyond repute
 



Cancer Survivorship
Quote:
Here's an example line, that allows user "root" to access the system from any IP:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'
In the case you mentioned, I strongly advise using the IP of the host you're connecting from, instead of the wildcard (%). And only grant the remote system the privileges it needs.
enlytend is offline  
Old 03-23-2007, 12:18 PM   #5 (permalink)
cef
NamePros Regular
Join Date: May 2004
Location: NYC
Posts: 236
cef is a jewel in the roughcef is a jewel in the roughcef is a jewel in the rough
 


Animal Rescue
enlytend, agreed. If you can restrict access at the grant level to specific IPs/hosts/CIDR blocks, all the better. Sometimes I have to access dbs using remote tools from unknown locations, so for those circumstances I use very loose GRANT permissions.

However, to mitigate this, we then monitor logins via a BFD-like system so that we can dynamically block hack attempts at the firewall, and we also don't allow root logins with full privileges.
????: NamePros.com http://www.namepros.com/showthread.php?t=308004

So I guess that was a pretty bad sample line after all Thanks for pointing this out.

(But I did say this stuff was tricky )
cef is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


 
All times are GMT -7. The time now is 02:19 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger