# Clients and drivers

> Check login, query results, server-side preparation and application workflows.

---

LLMS index: [llms.txt](/llms.txt)

---

## What a successful connection proves {#clients}

All results below used the matching Mimus 19.0.1 full kernel and `pg_mysql` 1.0 on Rocky Linux 10 x86-64. A handshake identifies the advertised protocol. A simple query exercises parsing and one result set. An application test goes further by binding values, mutating rows, checking types and observing commit or rollback from another connection.

| Client | Login and query | Workload actually exercised |
|---|---|---|
| MariaDB `mysql` 10.11.19 | TCP, certificate-verified TLS, SCRAM-backed role, schema selection, `@@version` | Ordinary user created a table, inserted one row and read it. Native `psql` read the same key and text. |
| PyMySQL 1.1.1 | Advertised version `5.7.32-log`, `utf8mb4`, selected schema | Orders workflow: parameterized insert, `lastrowid=1`, three-row `executemany`, aggregates and Python `Decimal` / `datetime` results. Updated two rows, rolled back, then counted zero rows with the new status. Missing table reported 1146. |
| Go `database/sql` + go-sql-driver/mysql 1.9.3 | Default connection and TLS exercised | Server-side parameters, generated ID and row count, NULL, bytes, decimal, temporal scans with `parseTime=true`, duplicate key 1062 and subsequent reuse. A second connection saw the write only after commit. |
| MySQL Connector/J 8.4.0 | Preferred and required TLS, a separate RSA login and cached login | `useServerPrepStmts=true`: prepare-time metadata, generated keys, BLOB/NULL, batch and duplicate-key handling. `setAutoCommit(false)`, rollback, commit and re-enabling autocommit passed. |
| Oracle MySQL `mysqldump` and `mysql` 5.7.32 | Authenticated and selected the fixture schema | Exported and replayed supported DDL, a view, binary/generated values, a prefix PK and foreign keys. Destination was Mimus. [Restore procedure](/docs/mysql/operations/#mysql-dump) |

## Connect an application {#instance}

With the schema and role from the quick start, use TCP and pass the application schema as `database`. This Python example prompts for the password. Set `MYSQL_CA` to the trusted CA file or the public certificate from the loopback example.

```python
import os
from getpass import getpass
import pymysql

with pymysql.connect(host="127.0.0.1", port=3306, user="app_user",
                     password=getpass(), database="app", charset="utf8mb4",
                     ssl_ca=os.environ["MYSQL_CA"], ssl_verify_cert=True,
                     ssl_verify_identity=True) as conn:
    with conn.cursor() as cur:
        cur.execute("SELECT body FROM notes WHERE id=%s", (1,))
        print(cur.fetchone())  # ('hello',)
```

## Choose the preparation mode your application uses {#prepared-statements}

PyMySQL binds `%s` in this example by escaping values client-side and sending text SQL. The Go driver's default parameter path and Connector/J with `useServerPrepStmts=true` use the binary statement protocol. `COM_STMT_PREPARE`, `EXECUTE`, `CLOSE`, `RESET` and `SEND_LONG_DATA` are implemented. A single prepared statement accepts one SQL statement. Distinguish statement reset from `COM_RESET_CONNECTION`, which also rolls back active work and clears session state. A pool that issues `COM_CHANGE_USER` will need a new connection instead.

## Reproduce the checks for your driver {#mysql-suite}

Record the driver version, TLS mode, interpolation/server preparation, autocommit and pool reset behavior. On a disposable schema insert a value containing quotes and binary zero, read its type and bytes, check duplicate-key handling, roll back and read from a second connection. Use a binary column for the zero byte. The 19.0.1 session transaction run passed 56 checks; the named versions in the table bound the result. Other drivers, ORM schema discovery and connection pools need their own runs.

---

Backlinks:

- [MySQL](/docs/mysql/)
- [SQL and type compatibility](/docs/mysql/compatibility/)
- [Limits and troubleshooting](/docs/mysql/status/)
