There's also the SHOW CREATE TABLE <tablename> sql command:

        http://www.mysql.com/doc/S/H/SHOW_CREATE_TABLE.html

According to

        http://www.mysql.com/documentation/mysql/bychapter/manual_News.html#News-3.23.x

this command is available from 3.23.20 on.

        -steve


At 4:39 PM -0400 6/14/02, "Don Vu" <[EMAIL PROTECTED]> wrote:
>if you do mysqldump -d -p -u <USERNAME> <DATABASENAME> > <FILENAME> 
>then it will pipe only the CREATE TABLE statements and no insert 
>statements into <FILENAME>.
>
>-Don
>
>-----Original Message-----
>From: Erik Price [mailto:[EMAIL PROTECTED]]
>Sent: Friday, June 14, 2002 4:39 PM
>To: Hihn Jason
>Cc: [EMAIL PROTECTED]
>Subject: Re: Reconstructing SQL create table statements
>
>
>
>On Friday, June 14, 2002, at 04:06  PM, Hihn Jason wrote:
>
>>  I have a large number of tables that have been created through the
>>  years,
>>  and I wish to obtain the SQL statements used to create them. I can go
>>  through and do it all by hand, but that would take forever. Is there a
>>  way
>>  to run a script against the database that will generate them for me? If
>>  it
>>  misses the occasional additional index, then that is fine.
>
>If you have the mysql client programs and are using a Unix machine
>(maybe even Win but I'm not sure) you can use the mysqldump program.  It
>is usually located in the "bin" directory of your MySQL distribution. 
>Mine is /usr/local/mysql/bin/mysqldump.
>
>Read up on it, it can dump all data from your database and does so with
>the CREATE TABLE statements attached so that the whole thing can
>literally be rebuilt from scratch.  Just chop off the contents if you
>only want the CREATE TABLE statements.
>
>
>Erik
>
>
>
>
>----
>
>Erik Price
>Web Developer Temp
>Media Lab, H.H. Brown
>[EMAIL PROTECTED]
>


-- 
+------------------------------------------------------------------------+
| Steve Edberg                                      [EMAIL PROTECTED] |
| University of California, Davis                          (530)754-9127 |
| Programming/Database/SysAdmin               http://pgfsun.ucdavis.edu/ |
+------------------------------------------------------------------------+
| "If only life would imitate toys."                                     |
|                  - Ted Raimi, March 2002                               |
|                  - http://www.whoosh.org/issue67/friends67a.html#raimi |
+------------------------------------------------------------------------+

---------------------------------------------------------------------
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