# Connect to MySQL

> Use Schemity as a MySQL schema visualizer desktop app. Connect to MySQL or MariaDB, with every connection field explained, and reverse-engineer your schema offline.

Source: https://schemity.com/doc/connect-mysql/

Schemity works as a **MySQL schema visualizer desktop** application. Point it at a MySQL or MariaDB database and it introspects the structure into an ERD, entirely on your machine.

## How do I connect Schemity to MySQL?

Click **+** above the diagram list, set **DB type** to **MySQL**, click **Connect to a database**, and set **Connect via** to **Direct connection** (or **SSH Tunnel** for a database behind a bastion).

## What do the MySQL connection fields mean?

- **Host** and **Port** - the server address and port. Port defaults to `3306`.
- **Username** - the account Schemity authenticates as; read-only is recommended.
- **Password** - stored in your OS keychain, never in the JSON file.
- **DB name** - the database to introspect. In MySQL the database is the schema, so there is **no separate Schema field**.
- **Encryption** - **Disable** (local dev only), **Require**, **Verify CA**, or **Verify full (recommended)**; the two verify modes also check the server certificate. See [encryption and certificates](https://schemity.com/doc/connections-overview/#how-do-i-encrypt-the-connection-and-verify-the-server-certificate).

If you chose **SSH Tunnel**, an extra block asks for the SSH host, port (default `22`), username, password, and an optional SSH key file.

## What does Schemity import from a MySQL database?

Schemity imports every table in the database (no selection step): tables and columns with their MySQL types, primary keys and nullability, foreign keys drawn as crow's foot relationships, unique constraints, and indexes.

## Why are foreign keys missing after a MySQL import?

Tables using the `MyISAM` engine do not enforce foreign keys, so none may appear in the metadata. Schemity still imports the tables; you can draw the missing relationships by hand on the canvas. See [Relationships](https://schemity.com/doc/relationships/).

## Next

Tidy the imported diagram on [The ERD Canvas](https://schemity.com/doc/erd-canvas/), or split it into focused [Context Views](https://schemity.com/doc/context-views/).
