I just recently installed Joomla! using a database that already had an instance of Joomla! installed in it. It was actually really easy. This article explains how to install multiple instances of Joomla! with 1 database.
Why is this useful?
These days, you can find affordable hosting providers that allow you to run as many MySQL databases as you need. The only limitation is the amount of space they take up. However, there are still some hosting providers out there that only allow 1 MySQL database per hosting account. If you want to run 2 or 3 Joomla! sub sites on your account, you have to be able to install all instances of Joomla! on the one database. Luckily, Joomla! makes a provision for this possibility.
Database Table Prefix
During installation, you have the option to specify a table prefix. So, if you are installing 3 instances of Joomla! on your server, you might use the following prefixes:
- Main Site: "main_"
- Sub Site 1: "sub1_"
- Sub Site 2: "sub2_"
You can use any string value you want for the database prefix, provided it is not longer than the pre-defined table name length specified in MySQL. It is not limited to 3 characters and an underscore. You could use something descriptive like "mainsite", "portfolio", and "photogallery". I recommend keeping it short and using an underscore to set the prefix apart from the rest of the table name.
The table prefix is what Joomla! uses to differentiate your Joomla! tables to other tables that might be in your database. It essentially treats the Joomla! tables as a database within a database set apart by the table prefix.
That's it. You now know how to use 1 MySQL database to install multiple instances of Joomla! on your server. It really is that easy.
Shared Tables for Multiple Joomla! Installations
Sharing tables (like main_content, main_users, etc.) between multiple Joomla! installations gets complicated. In fact, it is well beyond the scope of this article. If you are interested in this type of functionality, you might want to check out Multisites Site Manager PRO.