Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Copy existing table schema to a new table

Answer:

To copy the table schema of an existing table to a new table, without copying its data:

mysql> CREATE TABLE new_table LIKE old_table;

  1. Dump the table schema of a MySQL database
  2. How to rename table in MySQL
  3. Create temporary table in MySQL
  4. Add an existing user to an existing group
  5. How to REORG a table in MySQL

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>