Documentation Home
MySQL 8.4 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 40.2Mb
PDF (A4) - 40.3Mb
Man Pages (TGZ) - 262.0Kb
Man Pages (Zip) - 367.6Kb
Info (Gzip) - 4.0Mb
Info (Zip) - 4.0Mb


30.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 asinfo rather thanINFORMATION_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
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       |...