mysql - Finding schema differences -


i want compare db schema tables , columns identical.

mysql> select a.table_schema, a.table_name information_schema.tables left join information_schema.tables b on a.table_name = b.table_name a.table_schema = 'india' , b.table_schema = 'china' , b.table_name null; 

i expected above query return tables present in india db not there in china db. not seem working. apart tables differences need find columns may different in 2 db's.

i not want use applications navicat. need query or unix command.

you need move and b.table_schema = 'china' predicate join:

select a.table_schema, a.table_name  information_schema.tables left join information_schema.tables b   on b.table_schema = 'china'     , a.table_name = b.table_name a.table_schema = 'india'  , b.table_name null 

to find column information:

select a.table_name, a.column_name information_schema.columns left join information_schema.columns b   on b.table_schema = 'china'     , a.table_name = b.table_name     , a.ordinal_position = b.ordinal_position     , a.column_default   = b.column_default     , a.is_nullable      = b.is_nullable     , a.data_type        = b.data_type     , a.column_type      = b.column_type .... add other comparisons here depending on consider non identical. a.table_schema = 'india' , b.column_name null 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -