mysql中查看视图的元数据?

需求描述:

  查看视图的元数据的方法.

操作过程:

1.通过查看information_schema数据库下的views表来查看视图的定义语句

mysql> select definer,view_definition from information_schema.views where table_schema = 'test' and table_name = 'v01'\G
*************************** 1. row ***************************
        definer: root@localhost
view_definition: select `vw_01`.`a` AS `a`,`vw_01`.`b` AS `b` from `test`.`vw_01`
1 row in set (0.00 sec)

2.通过show create view语句来查看视图的元数据

mysql> show create view v01\G
*************************** 1. row ***************************
                View: v01
         Create View: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v01` AS select `vw_01`.`a` AS `a`,`vw_01`.`b` AS `b` from `vw_01`
character_set_client: utf8
collation_connection: utf8_general_ci
1 row in set (0.00 sec)

文档创建时间:2018年6月26日17:37:19

猜你喜欢

转载自www.cnblogs.com/chuanzhang053/p/9230320.html
今日推荐