Page 1 of 1
Duplicate-Copy-Replicate Database. PLEASE HELP.-{SOLVED}
Posted: Wed Mar 01, 2006 9:45 pm
by khaki_monster
hello guyz!
this is like backuping database. how do i duplicate/ copy a database? a scenario is like this, I’d like to copy my database to another database before its Truncated (“Empty”). I use this statement
Code: Select all
“INSERT INTO newDatabase.newTable SELECT * FROM Database.Table”
to move those data into another database(“newDatabase”). Another problem is I cant insert/ append another batch of data with the same statement I use to insert on newDatabase. Why?
hope received some feed'backs from you pepz
tanx in advanced...
cheerz!
Posted: Wed Mar 01, 2006 10:52 pm
by feyd
likely, the primary keys are colliding creating errors.
Posted: Wed Mar 01, 2006 11:03 pm
by khaki_monster
so, do you have any suggestion or idea that you'd like to share?

Moving/ Copying records from one database to another?
i really need some here
hope to received more feed'backs
tanx for the reply...
cheerz!
Posted: Wed Mar 01, 2006 11:04 pm
by feyd
I'd select all fields except the primary key (if auto-incremented)
Posted: Thu Mar 02, 2006 12:40 am
by khaki_monster
woud it be difficult to control those fields like to update/querying?... given all the datails from old database was copied to new datbase.
tanx again...
cheerz!
Posted: Thu Mar 02, 2006 3:00 am
by Benjamin
Here is a sample of the query generated by phpMyAdmin when it copies a database. You may want to look into installing that and using it to copy your database as that would be easier if you are able to.
Code: Select all
CREATE DATABASE `cmsCopy`;
CREATE TABLE `cmsCopy`.`pages` (
`id` int( 2 ) unsigned NOT NULL AUTO_INCREMENT ,
`linkname` varchar( 255 ) NOT NULL default '',
`pagetitle` varchar( 255 ) NOT NULL default '',
`heading` varchar( 255 ) NOT NULL default '',
PRIMARY KEY ( `id` )
) ENGINE = MYISAM DEFAULT CHARSET = latin1;
INSERT INTO `cmsCopy`.`pages`
SELECT *
FROM `cms`.`pages` ;
Posted: Thu Mar 02, 2006 9:04 am
by khaki_monster

wewwhh!! this is getting difficult for me...
it looks like your idea is some what the same with my previous statement. but thanx for sharing anyway and appreciated...
Code: Select all
“INSERT INTO newDatabase.newTable SELECT * FROM Database.Table”
how do you guyz duplicate a database and with each time appended/updated by new records?
i've been looking over google for some help... but no good results.
im gett'in prostrated already, more tips please...
cheerz!
Posted: Thu Mar 02, 2006 12:49 pm
by Benjamin
Wouldn't it be better just to run a cron job that backs up the entire database on a nightly basis?
Posted: Fri Mar 03, 2006 3:37 am
by khaki_monster
NO... My CMS is running with two database, database1 is where all temporary records are to be stored. records are being "cached" then move those temporary records to database2("as an archieve/backup") witch can updated anytime...
cron job is not a problem. i just use cron job for dumping my database server with mysqldump utility every month...
pls help me solved this one....
tanx for the attention...
cheerz!
Posted: Fri Mar 03, 2006 9:42 am
by pickle
Moved to Databases
Posted: Sat Mar 04, 2006 4:06 am
by khaki_monster
like how please... i need some sample code.
