-1

I'm starting a project where I need two different websites to interact with one database. They have different domains and different source codes.

My servers providers are Hostgator and Linode. Hostgator is a shared host and Linode is a virtual server where I can install a few versions of Linux including Ubuntu, Centus, etc.

My question is how do I set up a Database on one cPanel and allow other cPanels to connect to that database?

If someone knows a solution for this using Hostgator I would really appreciate as it seems to be a faster and maybe less time consuming task.

I also wonder about Linode, because I secretly believe that it's not doable with Hostgator, but on that case I wonder: 1 - how do I deal with two domains and two source codes? 2 - how do I connect both with the same database?

4
  • 1
    So, can you clarify what you're needing to do? Have a database on one service provider that a system from the other service provider connects to? What's the reason that you need to set things up this way? Sep 4, 2014 at 22:18
  • The 1st website is for an organization. The 2nd website is for a conference organized by the organization. The conference is a entity of a own but it share the users (attendees) with the organization (members). If someone signup on one website, hes/hers account should be good to login on both websites. Sep 4, 2014 at 23:43
  • So do you have an actual question?
    – hookenz
    Sep 5, 2014 at 0:16
  • Thanks Matt. I wasn't clear enough. I hope my edit helps you to understand it better. Sep 5, 2014 at 1:01

2 Answers 2

2

Instead of direct database access over the internet, I'd recommend setting up an HTTP API in the application which owns the database, allowing for the second application to fetch the information it needs from the first one.

Avoid database connections over the internet; you're exposing an authentication endpoint to the database, which is subject to potentially serious security bugs (see here), brute-force attacks, and data interception (you need SSL for the database connection, which is a headache).

An HTTP API is a much more predictable and easily secured way to get the functionality you need.

0

I've done more research and figured out that there are a couple of ways I can get to what I need with Hostgator.

Solution 1

As a reseller I can set up a database on one cPanel and allow the other cPanels to connect to that database. I could connect to it even if it was on a different server but as mentioned by @Shane Madden it's not very safe to do so. The solutions is to use the same type of host package for both cpanels and they will be on the server letting you connect to it as localhost on both websites.

http://support.hostgator.com/articles/hosting-guide/lets-get-started/reseller-hosting/can-a-reseller-set-up-a-database-on-one-cpanel-and-allow-the-other-cpanels-to-connect-to-that-database

Solution 2

The second solution is to create one cpanel and add the second domain as an add-on domain. It will have it's own files directory but both websites will contact to server as localhost.

http://support.hostgator.com/articles/cpanel/how-do-i-create-and-remove-an-addon-domain

Not the answer you're looking for? Browse other questions tagged .