MySQL 8.4 发行说明
给定一个架构名称,此过程将创建一个包含引用原始架构中所有表和视图的视图的同义词架构。例如,这可用于创建一个更短的名称来引用具有长名称的架构(例如 info
而不是 INFORMATION_SCHEMA
)。
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| world |
+--------------------+
mysql> CALL sys.create_synonym_db('INFORMATION_SCHEMA', 'info');
+---------------------------------------+
| summary |
+---------------------------------------+
| Created 63 views in the info database |
+---------------------------------------+
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| info |
| mysql |
| performance_schema |
| sys |
| world |
+--------------------+
mysql> SHOW FULL TABLES FROM info;
+---------------------------------------+------------+
| Tables_in_info | Table_type |
+---------------------------------------+------------+
| character_sets | VIEW |
| collation_character_set_applicability | VIEW |
| collations | VIEW |
| column_privileges | VIEW |
| columns | VIEW |
...