> ## Documentation Index
> Fetch the complete documentation index at: https://docs.minimus.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Trino Plugins

> Add and configure Trino plugins in Minimus Trino images using Creator, including FIPS-compatible plugins and catalog setup examples.

For security reasons, Trino built by Minimus includes only 5 of the 54 plugins in the public image:

* Only plugins that operate entirely within the Trino JVM or use the local filesystem are included by default in the Minimus Trino image.
* Plugins that require external databases, cloud SDKs, or network endpoints to function are excluded by default.

To add more plugins, create a private image using Creator to install the plugins. The trino plugins are packaged by Minimus and have the same names as the original public plugins. For example: `trino-plugin-cassandra`, `trino-plugin-hive`, etc. If you're working with a Trino-FIPS image, install the Trino FIPS compatible plugins, for example `trino-fips-plugin-cassandra`.

<Tip>
  Trino plugins are tightly coupled to the exact server build. Creator handles these compatibility issues automatically.
</Tip>

## Install Plugins with Creator

The standard way to install Trino plugins when working with a Minimus Trino image is to create a private image using Creator.

1. Go to [Creator](https://images.minimus.io/creator/)
2. Select the Minimus Trino image as your starter image
3. Select the relevant packages. They're named `trino-plugin-{name}`.
4. Finish configuring your private image, adding env variables, certificates, etc. If you're using a Trino-FIPS starter image, install the FIPS plugins (their name takes the format: `trino-fips-plugin-{plugin-name}`).
5. Save and build the private image. Creator will build your custom Trino image in all available versions with the plugins of your choice and maintain it for you.

## Example: Configuring the MySQL Catalog for Trino

The following example uses a private Trino image with the MySQL connector plugin baked in. To query a MySQL database through Trino, you need to register it as a catalog.

This tutorial walks through the setup using Docker. We will deploy a custom Trino image alongside a MySQL instance and run a federated query across MySQL and Trino's built-in sample data.

### Prerequisites

* Docker installed and running

### Step 1: Start MySQL

Create a Docker network and start a MySQL container with a sample database:

```shellscript theme={null}
docker network create trino-test

docker run -d --rm --name mysql --network trino-test \
  -e MYSQL_ROOT_PASSWORD=demo \
  -e MYSQL_DATABASE=shop \
  reg.mini.dev/mysql:8
```

Wait a few seconds for MySQL to initialize, then seed a sample table:

```sql theme={null}
docker exec -i mysql mysql -uroot -pdemo shop <<'SQL'
CREATE TABLE products (
  id INT PRIMARY KEY,
  name VARCHAR(100),
  price DECIMAL(10,2)
);
INSERT INTO products VALUES
  (1, 'Keyboard', 49.99),
  (2, 'Monitor', 299.99),
  (3, 'Mouse', 24.99);
SQL
```

### Step 2: Write the Catalog Properties

Create a file called `mysql.properties` in your working directory:

```text theme={null}
connector.name=mysql
connection-url=jdbc:mysql://mysql:3306
connection-user=root
connection-password=demo
```

This tells Trino how to connect to the MySQL instance. The hostname `mysql` matches the container name on the Docker network.

### Step 3: Start Trino

Use Creator to build a private image with the package `trino-plugin-mysql` and name it `trino-mysql`.

Run the Trino-MySQL image and mount the catalog file (replace the `{id}` with your own tenant ID before running the command):

```text theme={null}
docker run -d --rm --name trino --network trino-test \
  -p 8080:8080 \
  -v $(pwd)/mysql.properties:/etc/trino/catalog/mysql.properties \
  reg.mini.dev/{id}/trino-mysql:latest
```

Wait for Trino to finish starting up (about 30 seconds), then confirm the MySQL catalog is registered:

<CodeGroup>
  ```shellscript command theme={null}
  docker exec trino trino --execute "SHOW CATALOGS"
  ```

  ```text expected output theme={null}
  "jmx"
  "memory"
  "mysql"
  "system"
  "tpcds"
  "tpch"
  ```
</CodeGroup>

You should see `mysql` in the output alongside the default catalogs (`system`, `tpch`, etc.).

### Step 4: Query MySQL through Trino

List the tables in the `shop` database:

```shellscript theme={null}
docker exec trino trino --execute "SHOW TABLES FROM mysql.shop"
```

Query the products table:

<CodeGroup>
  ```shellscript query command theme={null}
  docker exec trino trino --execute "SELECT * FROM mysql.shop.products"
  ```

  ```text expected output theme={null}
  "1","Keyboard","49.99"
  "2","Monitor","299.99"
  "3","Mouse","24.99"
  ```
</CodeGroup>

You should see the three rows inserted earlier.

### Step 5: Run a Federated Query

One of Trino's strengths is querying across multiple data sources in a single statement. Join the MySQL table with the built-in `tpch` sample data:

```text theme={null}
docker exec trino trino --execute "
SELECT p.name, p.price, n.name AS nation
FROM mysql.shop.products p
CROSS JOIN tpch.tiny.nation n
WHERE n.nationkey < 3
ORDER BY p.name, n.name
"
```

This query pulls products from MySQL and nations from the in-memory `tpch` catalog, all in one pass.

### Clean Up

Remove the containers and network:

```text theme={null}
docker rm -f trino mysql && docker network rm trino-test
```

## Catalog Reference

### How catalogs work

Trino uses catalog properties files to register data sources. Each `.properties` file placed in `/etc/trino/catalog/` becomes a catalog with the filename as its name (e.g., `mysql.properties` registers a catalog called `mysql`).

Queries follow a three-part naming convention: `catalog.schema.table`.

### Mounting catalogs in Kubernetes

When deploying with the Trino Helm chart, add catalogs through the `additionalCatalogs` field in your `values.yaml`:

```yaml theme={null}
additionalCatalogs:
  mysql: |
    connector.name=mysql
    connection-url=jdbc:mysql://mysql-host:3306
    connection-user=trino
    connection-password=secret
```

Each key becomes a catalog name and the value is the contents of the properties file. See the [Trino Helm chart documentation](https://trino.io/docs/current/installation/kubernetes.html) for the full set of options.

### Connection properties

| Property              | Description                                   |
| --------------------- | --------------------------------------------- |
| `connector.name`      | Always `mysql` for the MySQL connector        |
| `connection-url`      | JDBC URL in the form `jdbc:mysql://host:port` |
| `connection-user`     | MySQL user for Trino to authenticate as       |
| `connection-password` | Password for the MySQL user                   |

For the full list of tuning and security options, see the [Trino MySQL connector docs](https://trino.io/docs/current/connector/mysql.html).
