• 首页
  • vue
  • TypeScript
  • JavaScript
  • scss
  • css3
  • html5
  • php
  • MySQL
  • redis
  • jQuery
  • create_synonym_db()过程

    给定模式名称后,此过程将创建一个同义词模式,该模式包含引用原始模式中所有表和视图的视图。例如,可以使用它来创建一个短名称,通过该短名称来引用具有长名称的模式(例如info而不是INFORMATION_SCHEMA)。

    参量

    • in_db_name VARCHAR(64):要为其创建同义词的架构的名称。
    • in_synonym VARCHAR(64):用于同义词模式的名称。此架构必须不存在。

    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	|
    ...