Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Should I create a new TABLE or a new DATABASE?

6:04 pm on Jul 11, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:Sept 22, 2009
posts: 69
votes: 0


I have a social networking site programmed from the ground up in PHP/MySQL using 1 Database.

I would like to add a Forum to the site and have looked at the different PHP Forum Classes available at phpclasses.org and the open-source solutions available at sourceforge.net.

I haven't decided which solution to use (and I'm open to suggestions), but I was wondering if I should install the forum within the current (and only) Database of my site as new Tables or as a completely new Database with its own independent Tables?

In other words, when is it a good idea to forgo the main DB of your site and create a new DB for a new feature?

6:56 pm on July 11, 2010 (gmt 0)

Moderator from US 

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

joined:Dec 10, 2005
votes: 105

There's no "one size fits all" answer to that. But in general, I try to compartmentalize functionality as much as possible in my database structure and would most likely create a separate DB for the foums (and have on my sites). There is also the issue of security (using open source software to access a proprietary DB sounds like worrying I could do without).

There are also times when you would want/need to keep everything in the same table (e.g., a hosting limitatiion that only allows 1 DB).
1:13 am on July 12, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
votes: 0

Unless you have a specific reason to do so, I'd say separate DB. Especially with open source board software, any security breaches in the board, which is a pretty high profile target for hacking, could potentially affect your other databases. Make sure it logs in to mySQL with a different U and P too.

Or you could have a table with a name that conflicts with your other DBs.