mysql> SHOW PROCEDURE STATUS LIKE 'c%'\G
*************************** 1. row ***************************
Db: sys
Name: create_synonym_db
Type: PROCEDURE
Definer: mysql.sys@localhost
Modified: 2020-06-13 14:13:13
Created: 2020-06-13 14:13:13
Security_type: INVOKER
Comment:
Description
-----------
Takes a source database name and synonym name, and then creates the synonym database with views that point to all of the tables within the source database.
Useful for creating a "ps" synonym for "performance_schema",
or "is" instead of "information_schema", for example.
Parameters
-----------
in_db_name (VARCHAR(64)):
The database name that you would like to create a synonym for.
in_synonym (VARCHAR(64)):
The database synonym name.
Example
-----------
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| test |
+--------------------+
5 rows in set (0.00 sec)
mysql> CALL sys.create_synonym_db('performance_schema', 'ps');
+---------------------------------------+
| summary |
+---------------------------------------+
| Created 74 views in the `ps` database |
+---------------------------------------+
1 row in set (8.57 sec)
Query OK, 0 rows affected (8.57 sec)
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| ps |
| sys |
| test |
+--------------------+
6 rows in set (0.00 sec)
mysql> SHOW FULL TABLES FROM ps;
+------------------------------------------------------+------------+
| Tables_in_ps | Table_type |
+------------------------------------------------------+------------+
| accounts | VIEW |
| cond_instances | VIEW |
| events_stages_current | VIEW |
| events_stages_history | VIEW |
...
character_set_client: utf8mb4
collation_connection: utf8mb4_0900_ai_ci
Database Collation: utf8mb4_0900_ai_ci
*************************** 2. row ***************************
Db: test_db
Name: countp
Type: PROCEDURE
Definer: root@localhost
Modified: 2020-07-14 14:24:24
Created: 2020-07-14 14:24:24
Security_type: DEFINER
Comment:
character_set_client: gbk
collation_connection: gbk_chinese_ci
Database Collation: utf8mb4_0900_ai_ci
*************************** 3. row ***************************
Db: test_db
Name: countproc1
Type: PROCEDURE
Definer: root@localhost
Modified: 2020-09-03 12:12:16
Created: 2020-09-03 12:12:16
Security_type: DEFINER
Comment:
character_set_client: gbk
collation_connection: gbk_chinese_ci
Database Collation: utf8mb4_0900_ai_ci
3 rows in set (0.00 sec)
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/7101.html
標籤:MySQL
