List:General Discussion« Previous MessageNext Message »
From:Steve Edberg Date:June 14 2002 9:11pm
Subject:RE: Reconstructing SQL create table statements
View as plain text  
There's also the SHOW CREATE TABLE <tablename> sql command:

According to

this command is available from 3.23.20 on.


At 4:39 PM -0400 6/14/02, "Don Vu" <dvu@stripped> wrote:
>if you do mysqldump -d -p -u <USERNAME> <DATABASENAME> >
>then it will pipe only the CREATE TABLE statements and no insert 
>statements into <FILENAME>.
>-----Original Message-----
>From: Erik Price [mailto:pricee@stripped]
>Sent: Friday, June 14, 2002 4:39 PM
>To: Hihn Jason
>Cc: mysql@stripped
>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 Price
>Web Developer Temp
>Media Lab, H.H. Brown

| Steve Edberg                                      sbedberg@stripped |
| University of California, Davis                          (530)754-9127 |
| Programming/Database/SysAdmin      |
| "If only life would imitate toys."                                     |
|                  - Ted Raimi, March 2002                               |
|                  - |
Reconstructing SQL create table statementsHihn Jason14 Jun
  • Multi-table deletesBhavin Vyas14 Jun
    • Re: Multi-table deletesVictoria Reznichenko18 Jun
  • Re: Reconstructing SQL create table statementsErik Price14 Jun
RE: Reconstructing SQL create table statementsDon Vu14 Jun
RE: Reconstructing SQL create table statementsSteve Edberg14 Jun