MySQL 8.0 Release Notes
MySQL 8.0 Source Code Documentation
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
).
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.
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 |
...