10/12/2013

MySQL Administrator background

MySQL show tables - How do I list the tables in a MySQL database?

show tables;

http://alvinalexander.com/blog/post/mysql/list-tables-in-mysql-database

-------------------------------------------------------------------------------------

List all Foreign Constraint in MySQL

select 
    concat(table_name, '.', column_name) as 'foreign key',  
    concat(referenced_table_name, '.', referenced_column_name) as 'references'
from
    information_schema.key_column_usage
where
    referenced_table_name is not null;

Refer: http://www.conandalton.net/2008/09/list-foreign-key-constraints-in-oracle.html

-------------------------------------------------------------------------------------

Get database size (include data and index size)

SELECT table_schema "Data Base Name",
sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB"
FROM information_schema.TABLES
GROUP BY table_schema ; 

Refer: http://mysqladministrators.blogspot.com/2012/02/get-database-size.html

0 comments:

Post a Comment

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.

 
Toggle Footer