Skip to main content
Allows to connect to databases on a remote MySQL server and perform INSERT and SELECT queries to exchange data between ClickHouse and MySQL. The MySQL database engine translate queries to the MySQL server so you can perform operations such as SHOW TABLES or SHOW CREATE TABLE. You cannot perform the following queries:
  • RENAME
  • CREATE TABLE
  • ALTER

Creating a database

Engine Parameters
  • host:port — MySQL server address.
  • database — Remote database name.
  • user — MySQL user.
  • password — User password.
Settings

enable_compression

Enables zlib compression for the MySQL protocol connection. When set to 1, ClickHouse requests protocol-level compression from the MySQL server. Default value: 0. Example:

Data types support

The conversion of the spatial types (other than POINT, which is always converted) is controlled by the geometry flag of the mysql_datatypes_support_level setting, enabled by default. The generic GEOMETRY column type is mapped to the umbrella Geometry type (a Variant over the concrete geometric types). Because such a column can hold a value of any subtype, reading a value whose subtype has no ClickHouse counterpart (GEOMETRYCOLLECTION) throws an exception at read time; this incompatibility is accepted in exchange for a proper geometric type. Columns declared with the GEOMETRYCOLLECTION type are converted into String (the raw WKB) like all other MySQL data types. Nullable is supported.

Global variables support

For better compatibility you may address global variables in MySQL style, as @@identifier. These variables are supported:
  • version
  • max_allowed_packet
By now these variables are stubs and don’t correspond to anything.
Example:

Examples of use

Table in MySQL:
Database in ClickHouse, exchanging data with the MySQL server:
Last modified on August 5, 2026