I have a mysql database with data. I want to change the database table structure.(to add some new columns to some tables, add new tables).Keeping the data in the database, this can be done and it is ok. But I want to export data to the new modified database from earlier database.That means,I have the structure of the database without data and I change the tables and add new tables to the database.Then I want to export data (which was in earlier database) to the new modified database.Here, one by one tables can be exported.But if there are more tables and more columns,how can I accomplish this in one pc and one mysql server?
Share
If you use mysqldump and omit the DDL statements (
-toption) as well as use complete inserts (-coption), you should be able to take the old table’s data and insert it into the new table without trouble.However, this does assume that you’re NOT changing the names/types of any of the tables/fields, and are simply adding new+different fields. If you’re changing table names and/or field names, then you’re better off importing the dump into a separate temporary database and doing an
insert ... select fromtype query where you can specify the new field mappings.