Raja G
Raja G

Reputation: 6673

How to get table structure at a time for many?

I have a MySQL database say test. It contains 10 tables. I know I can do describe <table_name> to get skeleton of that table. But I have to do that for each table individually.

This is my problem. Any query or script I can write to get the skeleton of all those tables at time?

Upvotes: 0

Views: 207

Answers (2)

Palec
Palec

Reputation: 13581

mysqldump can be told to skip data and dump only table schema.

mysqldump --no-data test

Use options -u <user> to connect as <user> and -p to ask for password. Maybe you also want --compact to be less verbose and possibly other. Many adjustments to the contents can be made using other options.

Upvotes: 0

Vignesh Kumar A
Vignesh Kumar A

Reputation: 28413

Try Like this

SELECT * FROM information_schema.columns Where TABLE_SCHEMA='test';

Upvotes: 1

Related Questions