How To Share A DB Between Sites

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • HairyChick
    Slowly dying
    • Sep 2012
    • 3091

    #1

    Tech How To Share A DB Between Sites

    I'm planning on a site that has a backend db. I registered a similar domain, too I want to build site A then clone it on site B.

    The db needs to be shared on both sites so I can update A and B will update.

    Design, post, backend db, everything needs to instantly updated. With amnesia I can't remember how it's done. Ideally, I'd like to update A then click a link in the backend to copy over all changes.

    I'd rather not have to ftp over the changes, PHPmyadmin copy the db, etc. Simple and easy with nothing to remember but one click.

    Doable? Extensive coding or not too time-consuming?
    *****************************************
    Anti-Semites have Small Penis Syndrome. The only known treatment is electroshock therapy combined with cerebellum removal. Fortunately, it’s a tiny procedure.
    *****************************************
  • LouiseLloyd
    SO FUCKING SCAMMED
    • Mar 2010
    • 1432

    #2
    Originally posted by PamWinterReturns
    The db needs to be shared on both sites
    Have both sites use the same db!?

    Comment

    • freecartoonporn
      Confirmed User
      • Jan 2012
      • 7683

      #3
      set up one DB.

      set up two sites using same DB.
      SSD Cloud Server, VPS Server, Simple Cloud Hosting | DigitalOcean

      Comment

      • HairyChick
        Slowly dying
        • Sep 2012
        • 3091

        #4
        Set up one db? Seems too simple. Build site A, then configure site B with same credentials as site A!?

        If so, how will B update ?? Don't I need to manually tell A you update B?
        ? ?
        *****************************************
        Anti-Semites have Small Penis Syndrome. The only known treatment is electroshock therapy combined with cerebellum removal. Fortunately, it’s a tiny procedure.
        *****************************************

        Comment

        • Barry-xlovecam
          It's 42
          • Jun 2010
          • 18083

          #5
          If the domains are on the same server they can use the same database logins as localhost.
          Alternatively, each domain could be a separate database user (sharing the same database).

          Each database has users with grant privileges given (configured) by the database root.
          root@localhost
          Code:
          mysql -u root -p
          Enter password:*******
          
          CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
          GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
          ON `databasesprefix%`.* TO user@localhost IDENTIFIED BY 'password';
          
          FLUSH PRIVILEGES;
          A database user (MySQL) can have a difference user name and password than the UNIX (webroot user) -- they probably should.

          You can allow database remote connections restricted only to authorized static IPs also.

          Comment

          • Barry-xlovecam
            It's 42
            • Jun 2010
            • 18083

            #6
            Originally posted by PamWinterReturns
            Set up one db? Seems too simple. Build site A, then configure site B with same credentials as site A!?

            If so, how will B update ?? Don't I need to manually tell A you update B?
            ? ?
            Depends on A and B's write privileges to the shared database.

            Comment

            • TFCash
              Confirmed User
              • Apr 2001
              • 1738

              #7
              Pam -

              you need to specify, are you talking about a custom script that is running the two sites, or are you using wordpress like all your other posts talk about ???

              If it's a custom script, then they should be able to share the same database with a few code changes. If your talking about using wordpress for two domains from the same database, it can be done, but it's a lot more headaches than it's worth. Better to just have siteB feed off of siteA with a plugin like https://wordpress.org/plugins/feedwordpress/

              TeenFlood.com Online since 1998.

              TFCash KissMeGirl
              VirginRiches MondoBucks

              tim at tfcash.com or submit a ticket at our HelpDesk

              Comment

              • wankawonk
                Confirmed User
                • Aug 2015
                • 1018

                #8
                easy to do if you have tech skills but if you're fucking around with scripts that other people wrote and you don't understand how they work it's gonna be hard to figure out, and you probably won't find usable technical help on gfy

                Comment

                • brandonstills
                  Confirmed User
                  • Dec 2007
                  • 1964

                  #9
                  When you specify which database to use just specify the connection info to the database.

                  Typically connection info consists of:

                  - hostname or IP address (defaults to localhost usually)
                  - port (usually just leave at default)
                  - database name (you choose this during setup typically)
                  - username / password

                  Brandon Stills
                  Industry and programming veteran
                  [email protected] | skype: brandonstills | ICQ #495-171-318

                  Comment

                  • Ferus
                    Bye - Left to do stuff
                    • Feb 2013
                    • 4108

                    #10
                    - Set the sites up individually
                    - have a developer build you a script that migrates the data from selected tabels in the database, to the new database
                    - Have a developer set up a script that replicates selected mediafolders (uploads and media)

                    Only migrate selected tabels (content related) and media/upload folders.

                    If you replicate eveything, it will be a pain to maintain in regards to uploads, updates and security

                    Comment

                    • TACNet
                      Confirmed User
                      • Jan 2009
                      • 452

                      #11
                      Originally posted by PamWinterReturns
                      Set up one db? Seems too simple. Build site A, then configure site B with same credentials as site A!?

                      If so, how will B update ?? Don't I need to manually tell A you update B?
                      ? ?
                      We been doing this for years. One DB server backend that updates multiple sites across multiple servers

                      Obviously all the sites need to connect to the db server which can be done using localhost (if everything is one one server) or you can grant access by IP address for a multi server environment

                      Then simply use a script (eg PHP, Perl etc) to produce your pages on-the-fly so any changes are instantly reflected accross all sites

                      If you have a high traffic page (eg your index page) then you may want to have a cron script update that page say once every hour rather than on-the-fly as it can overload the db server.


                      TAC Amateurs - The World's LARGEST Amateur Porn Network

                      Comment

                      Working...