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:

	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" <dvu@stripped> 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: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
>
>
>
>
>----
>
>Erik Price
>Web Developer Temp
>Media Lab, H.H. Brown
>pricee@stripped
>


-- 
+------------------------------------------------------------------------+
| Steve Edberg                                      sbedberg@stripped |
| 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 |
+------------------------------------------------------------------------+
Thread
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