MySQL8.0 中文参考手册 / 第28章 MySQL 系统模式 / 28.4 sys 模式对象参考 / 28.4.4 sys 模式存储过程 /
28.4.4.1 create_synonym_db() 过程
给定模式名称,此过程将创建一个同义词模式,其中包含引用原始模式中所有表和视图的视图。例如,这可用于创建一个较短的名称,通过该名称来引用具有长名称(例如info
而不是
INFORMATION_SCHEMA
)的架构。
Press CTRL+C to copymysql> 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 | ...