Anyone ever merge 2 different mySQL databases?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ruff
    I have a plan B
    • Aug 2004
    • 5507

    #1

    Anyone ever merge 2 different mySQL databases?

    I'm trying to cobble together a new TGPX site. I've got a mySQL database with 12 years of daily updates in text form that I would like to merge into a new database.
    Is this doable? Has anyone ever done it or know someone who has?
    I may have to get a copy of mySQL for dummies otherwise.

    Now just because I mentioned TGPX, I don't want everybody here to start building TGP sites. Promise?
    CryptoFeeds
  • Klen
    • Aug 2006
    • 32235

    #2
    Funny, i think i did same for same reason, but i don't remember what exactly i was doing it then.

    Comment

    • S3X_Jay
      Registered User
      • Dec 2020
      • 38

      #3
      Originally posted by ruff
      I'm trying to cobble together a new TGPX site. I've got a mySQL database with 12 years of daily updates in text form that I would like to merge into a new database.
      Is this doable? Has anyone ever done it or know someone who has?
      I may have to get a copy of mySQL for dummies otherwise.

      Now just because I mentioned TGPX, I don't want everybody here to start building TGP sites. Promise?
      It's doable. Just some SQL statements. What they would look like depends on the data structure of the databases.
      For the past 12+ years I've focused on building & running gay affiliate sites.

      Comment

      • ruff
        I have a plan B
        • Aug 2004
        • 5507

        #4
        I'm learning just enough to fuck up. But the installation is new so I backed up the new empty database for good measure. So I will try to figure out the data structure and match what I have to what the TGPX database has.
        CryptoFeeds

        Comment

        • Pink24
          So Fucking Banned
          • Aug 2019
          • 1436

          #5
          Originally posted by ruff
          I'm learning just enough to fuck up. But the installation is new so I backed up the new empty database for good measure. So I will try to figure out the data structure and match what I have to what the TGPX database has.
          If you need any help let me know.


          j/k yer feckin worm

          Comment

          • ruff
            I have a plan B
            • Aug 2004
            • 5507

            #6
            Judging by the questions you continually ask on this forum, it's doubtful that you know anything useful.
            CryptoFeeds

            Comment

            • Pink24
              So Fucking Banned
              • Aug 2019
              • 1436

              #7
              Originally posted by ruff
              Judging by the questions you continually ask on this forum, it's doubtful that you know anything useful.
              Bet I know more than you.

              I might act stoopid (for fun) but I have an IQ of some high number.

              Comment

              • PornDiscounts-V
                Confirmed User
                • Oct 2003
                • 5744

                #8
                Completely doable. You just need to import the data according to the new structure.
                Blog Posts - Contextual Links - Hardlinks on 600+ Blog Network
                * Handwritten * 180 C Class IPs * Permanent! * Many Niches! * Bulk Discounts! GFYPosts /at/ J2Media.net

                Comment

                • sarettah
                  see you later, I'm gone
                  • Oct 2002
                  • 14301

                  #9
                  Merged databases many times.

                  Some were easy, some a bitch.

                  Have fun.

                  .
                  All cookies cleared!

                  Comment

                  • carolwebb
                    Confirmed User
                    • Jan 2020
                    • 221

                    #10
                    Can you dump the old table info into a csv file, then upload the csv to the new database table?

                    Like so?
                    SELECT customer_id, firstname, surname INTO OUTFILE '/customers.csv'
                    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
                    LINES TERMINATED BY '\n'
                    FROM customers;


                    LOAD DATA INFILE '/customers.csv'
                    INTO TABLE customers
                    FIELDS TERMINATED BY ','
                    ENCLOSED BY '"'
                    LINES TERMINATED BY '\n'
                    IGNORE 1 ROWS;

                    BCams
                    :
                    hard core redditor

                    Comment

                    • ruff
                      I have a plan B
                      • Aug 2004
                      • 5507

                      #11
                      Originally posted by carolwebb
                      Can you dump the old table info into a csv file, then upload the csv to the new database table?

                      Like so?
                      SELECT customer_id, firstname, surname INTO OUTFILE '/customers.csv'
                      FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
                      LINES TERMINATED BY '\n'
                      FROM customers;


                      LOAD DATA INFILE '/customers.csv'
                      INTO TABLE customers
                      FIELDS TERMINATED BY ','
                      ENCLOSED BY '"'
                      LINES TERMINATED BY '\n'
                      IGNORE 1 ROWS;
                      I'm going to try that and see if it works. Thx.
                      CryptoFeeds

                      Comment

                      • k0nr4d
                        Confirmed User
                        • Aug 2006
                        • 9231

                        #12
                        Originally posted by ruff
                        I'm going to try that and see if it works. Thx.
                        We do this all the time. That way won't work well for you because the table would have to have fields in the same order.

                        You should make one user that has access to both databases and then do something like

                        INSERT INTO `newDb`.`newTable` (col1,col2,col3,col4,col5) SELECT correspondingcol1,correspondingcol2,correspondingc ol3,correspondingcol4,correspondingcol5 FROM `oldDb`.`oldTable`
                        Mechanical Bunny Media
                        Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development

                        Comment

                        • redwhiteandblue
                          Bollocks
                          • Jun 2007
                          • 2793

                          #13
                          I obviously don't know how TGPX's tables are structured but if you have any relational tables in there then I wouldn't attempt this until you understand what they are and what tables they join to, otherwise just copying rows from one table to another will muck up the indices. Make sure you back everything up because you are bound to screw this up several times over and SQL doesn't have an undo button.
                          Interserver unmanaged AMD Ryzen servers from $73.00

                          Comment

                          • ruff
                            I have a plan B
                            • Aug 2004
                            • 5507

                            #14
                            Thanks for the advice K0nr4d and redwhiteandblue.

                            MojoHost is dumping the databases for me to work on offline and suggested some links for programs to use. Since the TGPX site is brand new, I can always re-install everything if I wreck the merge. It will be worth it though if it works.
                            CryptoFeeds

                            Comment

                            Working...