MySQL 9.0 版本資訊
給定一個 schema 名稱,此程序會建立一個同義詞 schema,其中包含參考原始 schema 中所有表格與檢視表的檢視表。例如,這可以用來建立一個較短的名稱,以參考一個名稱很長的 schema(例如使用 info
而不是 INFORMATION_SCHEMA
)。
in_db_name VARCHAR(64)
:要建立同義詞的 schema 名稱。in_synonym VARCHAR(64)
:要用於同義詞 schema 的名稱。此 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 |
...