> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-vortex-format.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Documentation for the MySQLWire format

# MySQLWire

| Input | Output | Alias |
| ----- | ------ | ----- |
| ✗     | ✔      |       |

<h2 id="description">
  Description
</h2>

The `MySQLWire` format serializes query results as a MySQL wire-protocol result set. It writes the column count and
column definitions followed by one protocol row packet for each result row and a final `EOF` or `OK` packet. The row
packets use the text protocol for normal queries and the binary protocol for prepared statements.

This is an output-only binary format intended for clients connected through ClickHouse's
[MySQL interface](/concepts/features/interfaces/mysql). The interface selects `MySQLWire` automatically and supplies
protocol state such as the client's capabilities and the packet sequence number. It's not intended for displaying or
storing query results as a standalone file.

<h2 id="example-usage">
  Example usage
</h2>

After enabling the MySQL interface, use a compatible client to execute a query:

```shell theme={null}
mysql --protocol tcp -h 127.0.0.1 -u default -P 9004 default \
    -e "SELECT number, number * 2 AS doubled FROM numbers(3)"
```

The interface sends the result using `MySQLWire`; an explicit `FORMAT MySQLWire` clause is optional. Other explicit
output formats aren't supported over the MySQL interface.

<h2 id="format-settings">
  Format settings
</h2>

There are no user-configurable format settings. The MySQL interface derives the required settings from the client
handshake and the command being executed.
