GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Anyone ever merge 2 different mySQL databases? (https://gfy.com/showthread.php?t=1340108)

ruff 01-06-2021 02:49 PM

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? :1orglaugh:1orglaugh:1orglaugh

Klen 01-06-2021 03:04 PM

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

S3X_Jay 01-06-2021 03:08 PM

Quote:

Originally Posted by ruff (Post 22800502)
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? :1orglaugh:1orglaugh:1orglaugh

It's doable. Just some SQL statements. What they would look like depends on the data structure of the databases.

ruff 01-06-2021 03:19 PM

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.

Pink24 01-06-2021 04:36 PM

Quote:

Originally Posted by ruff (Post 22800529)
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

ruff 01-06-2021 04:48 PM

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

Pink24 01-06-2021 04:55 PM

Quote:

Originally Posted by ruff (Post 22800599)
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.

PornDiscounts-V 01-06-2021 05:21 PM

Completely doable. You just need to import the data according to the new structure.

sarettah 01-06-2021 05:24 PM

Merged databases many times.

Some were easy, some a bitch.

Have fun.

.

carolwebb 01-06-2021 11:51 PM

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;

ruff 01-07-2021 07:30 AM

Quote:

Originally Posted by carolwebb (Post 22800943)
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.

k0nr4d 01-07-2021 07:45 AM

Quote:

Originally Posted by ruff (Post 22801123)
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`

redwhiteandblue 01-07-2021 07:55 AM

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.

ruff 01-07-2021 01:44 PM

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.


All times are GMT -7. The time now is 02:19 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc