I've taken my talents to another blog: brianjlink.com

Copy MySQL Table Structure & Data

Here’s a quick hit set of MySQL command-line instructions that will take create a new table in your database with the structure of an existing table and then duplicate the content as well:

CREATE TABLE new_stuff LIKE old_stuff;
INSERT new_stuff SELECT * FROM old_stuff;

This is a great and quick way to make dummy tables of data for testing purposes or for making regular table backups inside your own database for easy comparison or a million other uses that come up every day when working with databases.

April 21st, 2009 | MySQL | 0 Comments