This topic is locked

Create an SQL Script From Table

4/29/2005 1:07:55 PM
PHPRunner General questions
pplaut author

Is there a way to take a table which has already been created, wave a magic wand, and create a mysql script which will create the table??? <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=1377&image=1&table=forumtopics' class='bbc_emoticon' alt=':o' />
I am making minor changes to the tables and when I am done I would just like to export the field properties to make a sql script to recrate the table with the fields, indexes, etc.
Thanks

Peer

Admin 5/4/2005

Peer,
you can use mysqldump program bundled with MySQL. Here is example you can run from command line:

mysqldump -d -h host -u username -ppassword database table > script.sql


where host, username, password, database and table are your MySQL connect parameters and table you want to script out.

-d option suppresses including table data in script.

mysqldump --help



shows full option set.
Also there are a lot of visual MySQL managers which can create table creation scripts.

pplaut author 5/4/2005

You the man.

Thanks

Peer

K
Knud van Eeden 5/7/2005

Database: MySql: Backup: How to backup your MySql databases on Microsoft Windows? [mysqldump.exe]

http://www.faqts.com/knowledge_base/view.p...id/35219/fid/52

K
Knud van Eeden 5/7/2005

Database: MySql: Backup: How to backup your MySql databases on Microsoft Windows? [PHPMyAdmin]

http://www.faqts.com/knowledge_base/view.p.../36016/fid/1806