SHOW SUBSCRIPTIONS
语法说明
返回所有发布名、发布租户名、发布的数据库名、发布给该租户的时间、订阅名和创建该订阅的时间。
语法结构
SHOW SUBSCRIPTIONS [ALL];
语法解释
- ALL 选项可以看到所有有权限的订阅,未订阅的 sub_time, sub_name 为 null,不加 ALL 只能看到已订阅的发布信息。
示例
mysql> show subscriptions all;
+----------+-------------+--------------+---------------------+----------+----------+
| pub_name | pub_account | pub_database | pub_time | sub_name | sub_time |
+----------+-------------+--------------+---------------------+----------+----------+
| pub3 | sys | t | 2024-04-23 11:11:06 | NULL | NULL |
+----------+-------------+--------------+---------------------+----------+----------+
1 row in set (0.01 sec)
mysql> show subscriptions;
Empty set (0.00 sec)
mysql> create database sub3 from sys publication pub3;
Query OK, 1 row affected (0.02 sec)
mysql> show subscriptions all;
+----------+-------------+--------------+---------------------+----------+---------------------+
| pub_name | pub_account | pub_database | pub_time | sub_name | sub_time |
+----------+-------------+--------------+---------------------+----------+---------------------+
| pub3 | sys | t | 2024-04-23 11:11:06 | sub3 | 2024-04-23 11:12:11 |
+----------+-------------+--------------+---------------------+----------+---------------------+
1 row in set (0.00 sec)
mysql> show subscriptions;
+----------+-------------+--------------+---------------------+----------+---------------------+
| pub_name | pub_account | pub_database | pub_time | sub_name | sub_time |
+----------+-------------+--------------+---------------------+----------+---------------------+
| pub3 | sys | t | 2024-04-23 11:11:06 | sub3 | 2024-04-23 11:12:11 |
+----------+-------------+--------------+---------------------+----------+---------------------+
1 row in set (0.01 sec)