mysqldump -d database table > existingTable.sql

Then edit existingTable.sql, change the name of the table, save it as
newTable.sql

mysql database < newTable.sql

You could do :
mysqldump -d database table | sed <REGEX to change the table name> | mysql
database

but I'm not an expert on regex.  :)

=C+


-----Original Message-----
From: Phil Schwarzmann [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 24, 2002 4:06 PM
To: [EMAIL PROTECTED]
Subject: copying the structure of a table to a new table


I want to copy the structure of a table to a brand new table, but I
don't want to use phpmyadmin or some other program.  I'm looking for the
command line code.

Anyone have a link to where I can find it?  Or, anyone wanna send me
the code?

Thanks!!

mysql

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to