Managed Catalog
A Managed Catalog is the built-in data catalog of AnalyticDB for MySQL. It manages the databases and tables that live inside the instance. In addition, external databases created with CREATE EXTERNAL DATABASE and external tables mapped with CREATE EXTERNAL TABLE (for example, tables that reference OSS, Hive, or MaxCompute data sources) also have their metadata managed by the adb Managed Catalog. Each instance contains exactly one Managed Catalog, fixed-named adb.
Limits
-
The Managed Catalog name is fixed as
adband cannot be changed. -
You cannot create additional Managed Catalogs.
-
Requires AnalyticDB for MySQL 3.2.7 or later.
Query data in the Managed Catalog
-
Connect to AnalyticDB for MySQL.
-
Connecting through a MySQL client opens the session in the
adbcatalog by default. -
Connecting through JDBC, you can specify the database in the connection string:
jdbc:mysql://<host>:<port>/adb.<db_name>. If the catalog is omitted,adbis used.
-
-
(Optional) List the databases in the instance:
SHOW DATABASES; -- or specify the catalog explicitly SHOW DATABASES FROM adb;SHOW DATABASESreturns a column namedDatabase. When specifying the catalog explicitly (SHOW DATABASES FROM adb), the column is namedSchema. -
(Optional) Switch the active database:
USE <db_name>; -- To specify both the catalog and the database USE adb.<db_name>; -
Query a table:
SELECT * FROM <table_name>;If you have not picked a database in the previous steps, address the table directly with two- or three-part names:
SELECT * FROM <db_name>.<table_name>; -- or SELECT * FROM adb.<db_name>.<table_name>;
Example
To query data in adb_db.adb_table, use any of the following:
-- Option 1: USE the database, then a one-part name
USE adb_db;
SELECT * FROM adb_table LIMIT 1;
-- Option 2: two-part name (current catalog is implied)
SELECT * FROM adb_db.adb_table LIMIT 1;
-- Option 3: three-part name (catalog made explicit)
SELECT * FROM adb.adb_db.adb_table LIMIT 1;
Related documents
-
Catalog overview: learn about the catalog model and its categories.
-
External Catalog: connect to data lakes and external databases.