homepage Welcome to WebmasterWorld Guest from 54.237.71.86
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Is it possible to use one MySQL DB by 2+ sites?
Newbie question...
GreenLeaf




msg:1273458
 2:57 pm on Aug 10, 2004 (gmt 0)

Is it possible to use one MySQL DB by 2+ sites in one hosting account (CPanel, reseller)?
If it's possible what should i do and how should i connect to DB?
Tnanks in advance.

 

jatar_k




msg:1273459
 4:05 pm on Aug 10, 2004 (gmt 0)

If they are in the same account does that mean they both have access to the same db? If you log into your site with ftp and they are both in the same area, then I would think you could use the same mysql_connect data in each site and it should work.

The best advice is to try it out. :)

Just use the same user/pass and then try connecting to mysql.

JasonHamilton




msg:1273460
 4:26 pm on Aug 10, 2004 (gmt 0)

even if the accounts are on different servers, as long as mysql can be connected to by a remote machine, it should not be an issue

GreenLeaf




msg:1273461
 4:36 pm on Aug 10, 2004 (gmt 0)

Thanks!
Should i use 'localhost' or something else?

JasonHamilton




msg:1273462
 4:36 pm on Aug 10, 2004 (gmt 0)

the remote site would have to use the ip address of the sql database server. if both are on the same machine, use localhost.

GreenLeaf




msg:1273463
 4:48 pm on Aug 10, 2004 (gmt 0)

Thanks a lot!

ergophobe




msg:1273464
 5:25 pm on Aug 11, 2004 (gmt 0)

Also, if the sites are not sharing a set of tables (in which case, why two sites?), come up with a prefix schema for your tables. So you have tables

site1_users
site1_other_table

site2_users
site2_other table

JasonHamilton




msg:1273465
 11:59 pm on Aug 29, 2004 (gmt 0)

I'd rather keep everything the same, and have the connection random which server it uses.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved