Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have 2 websites and would like to use the same database for both sites.

The MySQL database contains just a simple guestbook. The websites are one seperate hosting accounts, but with the same host.

I'm looking to link the two sites to the database. Does anyone know if or how this is possible?

share|improve this question
    
The websites are one seperate hosting accounts, but with the same host. I don't think so, sorry. Normally yes, you just specify the same MySQL server details. –  ionFish Jun 21 '12 at 20:39

2 Answers 2

Yes it is possible.

Once you know the Host, Username and Password for your MySQL account, you can just log in to it as you normally would from as many hosts as you want.

I once did it with two different hosts. My website was on one host, and from other host I was running some cron jobs that were running queries on the other site.

Although depending on your set-up, you may need to enable external host login, because some hosts have that disabled.

share|improve this answer

I work with one client that has 20-25 websites (each website pointing to a different database) in one MySQL instance. All low-trafficked. Of course, each website has its own facing.

What you are proposing sounds like 2 websites pointing to the same database within one MySQL instance. It sounds likes it is no big deal. I would just make sure that the guest book can record from which website (URL, IP Address, etc) and through which host account the guest entry was made.

share|improve this answer

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.