How do you view all the constraints (Primary keys, Secondary keys, Assertions , Triggers, etc) in a MySQL Database / Table in the command line environment.
+1
A:
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.
Arto Uusikangas
2009-11-18 07:03:10
Thanks Arto!I googled on this and there exists a series of commands for this purpose. Please referhttp://dev.mysql.com/doc/refman/5.0/en/show.html
EFreak
2009-11-18 07:21:20
+1
A:
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.
MarkR
2009-11-18 07:58:52
I tried this but am unable to use this option as I don't have the permission to lock tables/dbs
EFreak
2009-11-18 11:32:39
You do not need to lock the tables to dump the schema. I specifically suggested not trying to.
MarkR
2009-11-18 16:45:17
sry! I missed that.This is a better solution I guess. Dumps all the information it has.Syntax:mysqldump -uusername -hhostname -p --no-data --lock-tables=0 dbnameMore details available athttp://dev.mysql.com/doc/refman/5.1/en/mysqldump.html
EFreak
2009-11-19 06:31:13