Can I Import an updated structure into a MySQL table without losing its current content?
Posted
by
Udi Wertheimer
on Stack Overflow
See other posts from Stack Overflow
or by Udi Wertheimer
Published on 2011-01-02T20:40:56Z
Indexed on
2011/01/02
20:53 UTC
Read the original article
Hit count: 232
We use MySQL tables to which we add new fields from time to time as our product evolves. I'm looking for a way to export the structure of the table from one copy of the db, to another, without erasing the contents of the table I'm importing to.
For example say I have copies A and B of a table, and I add fields X,Y,Z to table A. Is there a way to copy the changed structure (fields X,Y,Z) to table B while keeping its content intact?
I tried to use mysqldump, but it seems I can only copy the whole table with its content, overriding the old one, or I can use the "-d" flag to avoid copying data (dumping structure only), but this will create an empty table when imported, again overriding old data.
Is there any way to do what I need with mysqldump, or some other tool?
© Stack Overflow or respective owner