# MySQL

Run SQL against a MySQL or MariaDB database.

## Connect MySQL

1. In the sidebar, open **Connections** and press **Add connection**.
2. Type `mysql` and choose **MySQL**.
3. Fill in the fields. Each one says **Required** or **Optional**.
4. Press **Test and save**. GoRunner checks the connection before it saves anything.

The sheet asks for **Server**, **Port**, **Database**, **User**, **Password**, **TLS** and **Connection string**.

[Connections](https://docs.gorunner.io/build/connections) says how to sign in again, rename or delete it. In a product that embeds GoRunner, **Add connection** can be missing: then [your provider makes connections](https://docs.gorunner.io/embed/customer-connections) for you.

## Do things in MySQL

Add an **MySQL** step. Choose the row to see all its fields.

- [Execute Query](https://docs.gorunner.io/apps/mysql#fields-f-execute-query): Run a SQL query/command with parameterized? placeholders.

To start a workflow from MySQL, use a [Schedule](https://docs.gorunner.io/apps/schedule), [Webhook](https://docs.gorunner.io/apps/webhook) or [Form](https://docs.gorunner.io/apps/form) trigger.

Later steps read a step’s output by its name: see [Use data from earlier steps](https://docs.gorunner.io/build/use-data-from-earlier-steps).

## Limits

- A query that returns more than 50,000 rows fails the step. Add a `LIMIT` to read a page at a time.
- GoRunner Cloud reaches servers on the public internet only. On a self-hosted installation, an admin can allow private addresses with `WORKFLOW_PRIVATE_NETWORKS`.

Not in your list? See [When an app isn’t here](https://docs.gorunner.io/apps/when-an-app-isnt-here#q-not-in-list).

## For developers

In the API, which calls apps pieces, MySQL is `pieceId: "mysql"` with `actionId: "execute_query"`. [Get an app](https://docs.gorunner.io/api/apps/get-app) returns every field.

It can change something outside the run (`writes_external`). See [How versions and side effects work](https://docs.gorunner.io/apps#q-versions).

### MySQL › Execute Query

Run a SQL query/command with parameterized? placeholders.

- **Query · Required**: SQL using? placeholders for values. Put every value in Parameters rather than building it into the text: this connection allows several statements in one query, so a value pasted straight into the SQL can end the statement and start another one.
- **Parameters · Optional**: JSON array of values bound to the? placeholders in order, such as ["active", 10]. Pass very large integers (beyond 2^53) as strings to preserve full precision.

Source: https://docs.gorunner.io/apps/mysql
