Welcome to WebmasterWorld Guest from 54.196.212.62

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Is it possible to use one MySQL DB by 2+ sites?

Newbie question...

     

GreenLeaf

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

10+ Year Member



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

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

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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

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

10+ Year Member



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

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

10+ Year Member



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

JasonHamilton

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

10+ Year Member



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

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

10+ Year Member



Thanks a lot!

ergophobe

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

WebmasterWorld Administrator ergophobe is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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

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

10+ Year Member



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

Featured Threads

Hot Threads This Week

Hot Threads This Month