EFreak
EFreak

Reputation: 3289

View All Table / Database Constraints in MySQL

How do you view all the constraints (Primary keys, Secondary keys, Assertions , Triggers, etc) in a MySQL Database / Table in the command line environment.

Upvotes: 1

Views: 3394

Answers (2)

Arto Uusikangas
Arto Uusikangas

Reputation: 1909

DESCRIBE is an alias for SHOW COLUMNS, like a shortcut. If you want all the other stuff then you need to use SHOW commands for your stuff. And SHOW COLUMNS for the rest.

Describe

Show

Upvotes: 1

MarkR
MarkR

Reputation: 63616

Just dump the database without data using

mysqldump --no-data  (other options)

As if you were taking a backup. Use the same options as you do when taking a backup (maybe --lock-tables=0 - you don't need a lock when dumping the schema)

Without the data, you get just the schema which includes all those things you said above.

Upvotes: 3

Related Questions