Skip to main content

Posts

Showing posts from June 12, 2011

Copying a MySQL table with schema and keys, but not data!

I wanted to clone the schema of my table "aitossne-icode.sshkey" into a new table "kaydir.keytab". Here's what I did :


mysql> use keydir
Database changed
mysql> CREATE table keytab LIKE aitossne_icode.sshkey;
Query OK, 0 rows affected (0.06 sec)

mysql> show tables
    -> ;
+------------------+
| Tables_in_keydir |
+------------------+
| keytab           |
+------------------+
1 row in set (0.00 sec)