文档主页
MySQL 8.4 参考手册
相关文档 下载此手册
PDF (美国信纸) - 39.9Mb
PDF (A4) - 40.0Mb
手册页 (TGZ) - 258.5Kb
手册页 (Zip) - 365.5Kb
Info (Gzip) - 4.0Mb
Info (Zip) - 4.0Mb


MySQL 8.4 参考手册  /  ...  /  create_synonym_db() 过程

30.4.4.1 create_synonym_db() 过程

给定一个架构名称,此过程将创建一个包含引用原始架构中所有表和视图的视图的同义词架构。例如,这可用于创建一个更短的名称来引用具有长名称的架构(例如 info 而不是 INFORMATION_SCHEMA)。

参数
  • in_db_name VARCHAR(64):要为其创建同义词的架构的名称。

  • in_synonym VARCHAR(64):同义词架构要使用的名称。此架构必须不存在。

示例
Press CTRL+C to copy
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 | ...