StarTrek18
StarTrek18

Reputation: 323

Show all the create tables from a database?

I know that with a mysql_dump I can get the current tables and data inside of those tables into a sql file.

However, how can I get just the CREATE TABLE descriptions? I don't want to carry all the data, just be able to create the same tables in my local machine.

Upvotes: 0

Views: 60

Answers (3)

Oscar Rovira
Oscar Rovira

Reputation: 46

mysqldump -d -u someuser -p mydatabase > backup.sql

The -d option is the --no-data option

https://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_no-data

Upvotes: 1

Abhik Chakraborty
Abhik Chakraborty

Reputation: 44844

show create table `table_name`

will show the create structure.

https://dev.mysql.com/doc/refman/5.0/en/show-create-table.html

Upvotes: 0

D Mac
D Mac

Reputation: 3809

You want the -d switch (or --no-data) for mysqldump (not mysql_dump) - it means "no data".

Upvotes: 0

Related Questions