Most of the times, we get into position that we forget to take a backup of an existing MYSQL Table before doing a minor change, and later realized that we have landed in problems, as the change we just made, adversly effected some of the existing key/value or data change in a table.

To avoid such situations in my projects, I came up with the below ( short and sweet) MYSQL script, which takes a backup/copy of the entire table into a temp table. This makes sure that I have a full backup of the data and table format, in case something goes wrong. Below is tht script which copies the MYSQL Table to a new table with full data:



CREATE TABLE SCHEMA.customers_backup LIKE SCHEMA.customers;

 INSERT SCHEMA.customers_backup SELECT * FROM SCHEMA.customers;


Related Posts:

Sandeep Joshi
Mathematics, Technology and Programming are my passion. I am a part of Java Ecosystem and through this blog, I contribute to it. I am here to blog about my interests, views and experiences.
I am on Google+ and Facebook.
I feel proud to be listed as a "National Memory Record Holder" in the Limca Book of Records, 2009 and have attempted for an International Memory record in the Guiness Book of Records. I can remember the value of PI upto 10,000 digits after the decimal (3.1415.....). You can contact me on ; I would like to hear from you :)