Is there a way to backup data using mysqldump --no-create-info ... where the inserts in the backup file will look like this:

insert into t1(col1, col2)values(val1,val2);

instead of

insert into t1 values(val1,val2);

The problem with the second way is that when the table structure changes, the insert will not work. With the first way, the table structure, e.g, one more column is added, will not affect the insert statement.

I have to use the mysqldump. Any suggestions please?


Use --complete-insert

Use complete INSERT statements that include column names.

Source: http://dev.mysql.com/doc/refman/5.5/en/mysqldump.html#option_mysqldump_complete-insert

  • The --complete-insert does not solve the problem stated above in my original post. It produces a dump file with the same issue presented in the original post. – The Georgia Jan 14 '15 at 7:11
  • Do you want to show or not show the column names? – Tan Hong Tat Jan 14 '15 at 7:13
  • Sorry Tan Hong Tat. It works. I did not examine the data properly. Thats what happened when you are a bit frustrated with something, you tend to overlook things. Thanks for the solution man. – The Georgia Jan 14 '15 at 7:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.