My client is a Data Center Architect.

Due to his experience with his work (many customers come to him because they have suffered great data loss in the past), he would like me to configure his Joomla site so that each component (JomSocial, EasyDiscuss, JomDirectory) stores its data in a separate database.

I have not been able to find any information about anyone ever having done anything like this.

I think it could slow the site down significantly but he would like to try it if it is possible.

Is this possible?

Is this a good idea?

2 Answers 2


Storing data for each component in a different database is an extremely bad idea. Yes, it is possible with Joomla, however you should have to hack into a large amount of core files, change database queries and so forth. If you decided to upgrade one of the extensions, it would override all your changes. So this is a no go.

Instead, I would suggest running a cron job that executes a script every X amount of hours or per day. This script would simply take a backup of all database tables that belong to the extension. You can either have a separate script per extension or combine them into 1, however I would recommend separate scripts, which will make it easier to maintain.

Once you have a backup of your tables, you can import them to your desired databases.

  • The only component I've ever seen do this was CiviCRM, and I have to tell you, configuring that is a pain if you do it that way. Plugins don't talk to it unless the db user is the same, and even then they have to be MADE to talk to it. I agree with this answer completely.
    – Brian Peat
    Commented Sep 16, 2014 at 16:21

If you are writing a component, you can store the data in another database or host or use another table prefix or driver like so:

$options = array(
    'driver' => 'mysqli',
    'host' => 'localhost2',
    'user' => 'myuser2',
    'password' => 'mypassword2',
    'database' => 'mydatabase2',
    'prefix' => 'joomlaprefix2',

$db = JDatabase::getInstance($options);

You can also change a third-party component if you are allowed but when you update the component, everything disappears.

  • This would mean hacking into core file that belong to components that the OP is already using, such as JomSocial, EasyDiscuss etc. I've explained why this is a bad idea ;)
    – Lodder
    Commented Sep 16, 2014 at 15:31
  • @Lodder, my answer is not about hacking core files of Joomla. So it's not as bad as you think ;)
    – Farahmand
    Commented Sep 16, 2014 at 15:39
  • Indeed, however your answer only applies for custom components which the OP hasn't mentioned. For 3rd party components, this would have to be added into the model.
    – Lodder
    Commented Sep 16, 2014 at 15:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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