Mysql – thesql database migration of schemas with updated data and structures

migrationMySQLmysql-workbenchmysqldump

I am a newbie with MySQL database dumps and am currently trying to work with data migration between a source schema and a target schema.

Assuming the source schema is defined by (source_table_structure, source_data) and the target schema is defined by (target_table_structure, target_schema), the resultant schema that I am looking at is (target_table_structure, source_data_WithNewSize) where the source_data_WithNewSize is basically the same source schema data with additional columns values filled by NULL.

Is it possible to use MySQL workbench to perform this type of migration? Are there other tools that are optimized for such migration?

Best Answer

There could be following two ways of doing the same.

First is you take unloads from source using following command

select * from table_name into outfile 'file_path' FIELDS TERMINATED BY ',' enclosed by '"' ;

Then on target you can do following

load data local infile 'file_path' into table table_name(Column_list_comma_seprated) FIELDS TERMINATED BY ',' enclosed by '"' escaped by '' ;

Or Else you can try following of inserting data

Replace into target_table(Column_list) select (Column_list) from source table;

Hope it helps.