1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

A daabase to use on different WP blogs at the same time?

Discussion in 'White Hat SEO' started by kesha1, Feb 28, 2010.

  1. kesha1

    kesha1 Registered Member

    Joined:
    Feb 15, 2010
    Messages:
    61
    Likes Received:
    0
    Hi,
    I have a dedicated server, and asked the technicians if I can have some database instaled there that I could use in my WP blogs that I host on other servers. They said yes, but only a one blog at the time can use it, which made me think that it would be nice to use a database in seveal blogs at the same time. So, is it posible to have one database on one server, and use it in different blogs simultanuasly on other servers?
    Thank you.
     
    Last edited: Feb 28, 2010
  2. portalweb

    portalweb Supreme Member Premium Member

    Joined:
    Jan 7, 2010
    Messages:
    1,415
    Likes Received:
    547
    Occupation:
    Hard Core Engineer
    Location:
    New York
    Yes, you can have many WP blogs connected to one MySQL DB server.
     
  3. djbetaboy

    djbetaboy Junior Member

    Joined:
    Dec 6, 2009
    Messages:
    117
    Likes Received:
    33
    Can you explain how to do it?I m also interested in this solution .
     
  4. kesha1

    kesha1 Registered Member

    Joined:
    Feb 15, 2010
    Messages:
    61
    Likes Received:
    0
    GREAT! You made my day! What should I tell them to configure and how is it different from what they think of it as in their opinion it could be used by only 1 blog?
     
  5. ukescuba

    ukescuba Jr. VIP Jr. VIP Premium Member

    Joined:
    Feb 24, 2008
    Messages:
    994
    Likes Received:
    634
    Occupation:
    Mobile Marketer & QR Code Junkie
    Location:
    San Antonio, TX
    Home Page:
    this is typical for a lot of scripts

    on your blog swap out the localhost, db name, username/password credentials for the ip address and username/password or your remote db

    i dont see why they should say only 1 blog could access it... unless they have it configured strangely who are you hosting with?

    @portalweb is it really necessary to have your location have all those full stops after new york? seems pointless to me and makes everyone reading posts youve responded too a pain in the ass as you have to scroll the page left to right
     
  6. portalweb

    portalweb Supreme Member Premium Member

    Joined:
    Jan 7, 2010
    Messages:
    1,415
    Likes Received:
    547
    Occupation:
    Hard Core Engineer
    Location:
    New York
    If you're using Linux and not using Cpanel, I suggest you to use free webmin, which I use it often to create the databases. If it's cPanel, you can create many wordpress accounts using several 3rd party installer such as Fantastaico or other cPanel plugins.

    Code:
    http://webmin.com
    @ukescuba: I'm just experimenting to poke around with my BHW profile. At least you got my attention on that annoying profile, which works great. In the distant future, I will make the change to my profile after I get bored with it. Frankly, I'm just trying to figure out on how to hack my profile to get around BHW profile restrictions, such as blinking fonts, annoying texts/colors, etc. Harros has it...so why not mine? :)
     
  7. funkman

    funkman Junior Member

    Joined:
    Dec 21, 2009
    Messages:
    115
    Likes Received:
    30
    Or just use Wordpress MU. If I got this thread right. :)
     
  8. kesha1

    kesha1 Registered Member

    Joined:
    Feb 15, 2010
    Messages:
    61
    Likes Received:
    0
    Yes, it work, it reads all the db entries from another server, BUT as soon as I click on any link in that blog that reads db from other server the broser jumps to the url of the original blog that has that db on a local host. How can I avoid it, stay within the URL of that clone on another server, and only read entries from the original, without jumping to the original local host db URL?
     
  9. kesha1

    kesha1 Registered Member

    Joined:
    Feb 15, 2010
    Messages:
    61
    Likes Received:
    0
    I guess it all come to this now: using the same db by different domains, how can I keep the relative URL paths of those domains without jumping to the db domain or any other than the URL of this blog?
     
  10. yeahright

    yeahright Registered Member

    Joined:
    Jan 17, 2009
    Messages:
    93
    Likes Received:
    32
    You can't unless you start getting dirty with wordpress. There is information stored in wp db's that is site specific (url, name of site, etc...). So unless you do some pretty heavy customization you're out of luck.
     
  11. judson

    judson Power Member

    Joined:
    Nov 29, 2009
    Messages:
    530
    Likes Received:
    319
    Occupation:
    Fulltime Newbie IM
    Location:
    Sub Ubi
    Your question is a bit too vague.

    The very short answer is:: Don't do it. That you are asking here means you probably don't know enough to do it right.

    The slightly longer answer is:: The technicians are wrong. It can be done.

    mmm. A more comprehensive answer.

    - Can you use a database on another server for your WP?

    Yes you can.

    - What do you need to do?
    Well, you need to set up the {database server} to accept connections from users on anything other than localhost. This has to be configured on the {mysql database SERVER}. You then need to create a database user on that server with privileges to log on from a different IP address. That is the database user you will use to connect to your database.

    -Should you do it?
    Probably not. When not done correctly, it introduces a whole raft of security issues. You get bonus points by leaving the database server untouched, but enabling SSH access (which you should already have on a dedicated server btw). You then create an SSH tunnel on your {WP Host Server} that redirects all database queries, via SSH to your {database server}. Your {database server} still sees those queries as localhost, so no changes required there. One of the benefits of SSH is secure connection between the {WP server} and the {database server}. Trying to use web admin panels to set up your database server introduces yet another layer of abstraction, and potential security holes. If you are not comfy with the command line, you probably should not do it.

    -No really, why should you not do it?

    Another issue is that it can introduce a performance hit. Think about it. To serve a page, a visitor visits your {WP server}. That then queries the {database server}. Only when it has received the result of those queries can it serve the pages. If the link between the {wp server} and the {database server} is a slow one, your whole website is slow. Plus, you have just doubled the amount of traffic passing through your {WP server}. YMMV but in 99% of the cases, this could end up being the bottleneck. You can of course use aggressive caching plugins and techniques to reduce the number of queries to the DB.

    - Can you use one database for many WP blogs?
    Yes you can. Easily. Just set a unique table prefix for each blog's installation. So, while sharing 1 database, each blog has effectively a unique set of tables so is totally independent. This is a hangover from the days when webhosts would limit the number of databases you could have on your hosting package. So, if you wanted more databases, you either upgraded the webhosting package to big $$, or you used table prefixes to keep each blog separate. Such a setup has its advantages, and some disadvantages too, so YMMV. I guess though, that this is not what you are asking ...

    - But I want them all to share the same underlying data ... can this be done?
    Yes it can.This is where you have start poking with the PHP in WP to override the two database entries that WP has for the original site address and home index page. This page is a good start and shows how it can be done easily
    http://codex.wordpress.org/Changing_The_Site_URL
    Not doing this, or changing the entries in the database is why as you put it, "the broser jumps to the url of the original blog that has that db on a local host". If you permanently want the DB shared by multiple blogs, it is a bit more involved than this, but I hope you get the hint.

    One more thing you need to watch out for, is plugins that do not play nice with such a setup, and insist on writing and hardcoding the URL in their database tables. Again, you will need to override these plugins individually. One more thing. All your blogs will need to share the same template. At the very least, they need to use a template called the same thing. It gets messy when you start using widgets different templates sharing the same name across several blogs. Needless to say, depending on your specific needs and usage, it can get pretty ugly pretty quickly just trying to stay on top of all the customisations. For the most part, you will have to say goodbye to one-click upgrades too.

    On top of all that, you have now introduced one point of failure for all your blogs that share that database. When ('when', not 'if', if you stick around the web long enough), your dedicated database server goes down, your entire farm goes offline. If you have several blogs depending on it, you had better have a pretty good data backup, and more importantly disaster recovery plan.

    Hmm, I could go on, but back to your original questions ..
    -Can it be done? Yes
    -Should it be done? Probably not. Whether you decide to have the WP installs share a database or not, you are probably better off just moving the blogs to the dedicated server that has the DB. Depending on how often your database changes, or new content is added, you might also get better traction from periodically replicating the data than from having multiple blogs share one database.

    I do understand that there are other considerations .. like separate IP addresses of the blogs for SEO, but if you do do it, at least know about the potential downsides as well.

    /J
     
    Last edited: Mar 1, 2010
  12. kesha1

    kesha1 Registered Member

    Joined:
    Feb 15, 2010
    Messages:
    61
    Likes Received:
    0
    Thank you so much for such a full answer. It helped a lot!