mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2026-10-28 16:18:23 +08:00
42 lines
1.6 KiB
Plaintext
42 lines
1.6 KiB
Plaintext
---
|
|
description: 'Documentation for the MySQLWire format'
|
|
keywords: ['MySQLWire']
|
|
slug: /interfaces/formats/MySQLWire
|
|
title: 'MySQLWire'
|
|
doc_type: 'reference'
|
|
---
|
|
|
|
{/*AUTOGENERATED_START*/}
|
|
| Input | Output | Alias |
|
|
|-------|--------|-------|
|
|
| ✗ | ✔ | |
|
|
|
|
## Description {#description}
|
|
|
|
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.
|
|
|
|
## Example usage {#example-usage}
|
|
|
|
After enabling the MySQL interface, use a compatible client to execute a query:
|
|
|
|
```shell
|
|
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.
|
|
|
|
## Format settings {#format-settings}
|
|
|
|
There are no user-configurable format settings. The MySQL interface derives the required settings from the client
|
|
handshake and the command being executed.
|
|
{/*AUTOGENERATED_END*/}
|