Documentation Home
MySQL 5.7 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 35.1Mb
PDF (A4) - 35.2Mb
Man Pages (TGZ) - 255.8Kb
Man Pages (Zip) - 360.8Kb
Info (Gzip) - 3.4Mb
Info (Zip) - 3.4Mb
Excerpts from this Manual

MySQL 5.7 Reference Manual  /  ...  /  The create_synonym_db() Procedure

26.4.4.1 The create_synonym_db() Procedure

Given a schema name, this procedure creates a synonym schema containing views that refer to all the tables and views in the original schema. This can be used, for example, to create a shorter name by which to refer to a schema with a long name (such as info rather than INFORMATION_SCHEMA).

Parameters
  • in_db_name VARCHAR(64): The name of the schema for which to create the synonym.

  • in_synonym VARCHAR(64): The name to use for the synonym schema. This schema must not already exist.

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