Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have been asked to build another site for someone else. Eventually, I will turn it over to them.

I will develop it locally, then take it live, then turn over full control. In the meantime I need a database for WP to interface with. Do I hook the new site into my existing database that I already have for my personal site or is it one database per website?

I would hate to have export my database along with someone else's.

share|improve this question

1 Answer 1

Multiple installs can share a single database, as long as each install has a unique table prefix defined in wp-config.php before going through the install process:

/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each a unique
 * prefix. Only numbers, letters, and underscores please!
 */
$table_prefix  = 'client_1_';

I personally find it easier to just create a new database for each install, as my host allows an unlimited number of databases. I do still however make the table prefix unique for every install, as it could possibly protect against SQL injection attacks if a client installs a bad plugin with insecure code.

share|improve this answer
1  
I also recommend the one-database-per-site approach, it's much easier to manage especially if your host allows unlimited databases. My approach to development locally is to create a unique database for every site I work on, then when development is complete I use backup buddy to migrate the local version to the production version (client server). This way you don't have to worry about mixing the concerns of different sites with one another. In some cases, if there are no dependencies I will develop multiple (simple) sites on the same local database; if it's just theme structure related. –  userabuser Jun 8 '13 at 3:51
    
Thanks for the tip on backup buddy. I am currently going through problems with my other database migration tool. –  Josh Smith Jun 8 '13 at 18:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.