Surya
Surya

Reputation: 3498

Append MYSQL dump to a table

I am getting two different dumps from two databases , All i need to do is , i need to append dump in to a single table , is this possible in mysql ..?

ex:- consider two sql files , first.sql file , second.sql file .

First.sql File has

name  date
name1 2013-06-01
name2 2013-06-01

second.sql file has

name  date
name3 2013-06-01
name4 2013-06-01

i would have to append them in a single table .

Final table

name  date
name1 2013-06-01
name2 2013-06-01
name3 2013-06-01
name4 2013-06-01

dump restore does truncate load

, i would like to append data at each sql restore command .

Upvotes: 7

Views: 9067

Answers (2)

Guillaume
Guillaume

Reputation: 14656

The .sql file is a script, you can edit it, and remove the part where it creates/drops the table.

If you're using mysqldump, you can add the --skip-add-drop-table and --no-create-info options so the drop/create table instructions won't be there in the first place

You can find more info on the mysqldump documentation page

Upvotes: 13

Surya
Surya

Reputation: 3498

mysqldump --skip-add-drop-table --no-create-info -u pentah_user -p test outtestactivity > outtestactivity1.sql

Upvotes: 1

Related Questions