I have table on MySQL server and would like to get the SQL that would re-create the table.
How do I get the query to recreate the SQL table?
MySQL supports SHOW CREATE TABLE
to return the SQL that was used to create a table.
From their docs:
mysql> SHOW CREATE TABLE t; CREATE TABLE t ( id INT(11) default NULL auto_increment, s char(60) default NULL, PRIMARY KEY (id) ) ENGINE=MyISAM
This can be useful if you have just a connection to the DB, versus a CLI on the server. If you have a CLI, use mysqldump like liamgriffiths recommends.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With