Documentation Index
Fetch the complete documentation index at: https://private-7c7dfe99-page-updates.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
MySQL Interface
ClickHouse supports the MySQL wire protocol. This allows certain clients that don’t have native ClickHouse connectors leverage the MySQL protocol instead, and it has been validated with the following BI tools: If you’re trying other untested clients or integrations, keep in mind that there could be the following limitations:- SSL implementation might not be fully compatible; there could be potential TLS SNI issues.
- A particular tool might require dialect features (e.g., MySQL-specific functions or settings) that aren’t implemented yet.
Enabling the MySQL Interface On ClickHouse Cloud
- After creating your ClickHouse Cloud Service, click the
Connectbutton.
- Change the
Connect withdrop-down toMySQL.
- Toggle the switch to enable the MySQL interface for this specific service. This will expose port
3306for this service and prompt you with your MySQL connection screen that include your unique MySQL username. The password will be the same as the service’s default user password.
Copy the MySQL connection string shown.
Creating multiple MySQL users in ClickHouse Cloud
By default, there is a built-inmysql4<subdomain> user, which uses the same password as the default one. The <subdomain> part is the first segment of your ClickHouse Cloud hostname. This format is necessary to work with the tools that implement secure connection, but don’t provide SNI information in their TLS handshake, which makes it impossible to do the internal routing without an extra hint in the username (MySQL console client is one of such tools).
Because of this, we highly recommend following the mysql4<subdomain>_<username> format when creating a new user intended to be used with the MySQL interface, where <subdomain> is a hint to identify your Cloud service, and <username> is an arbitrary suffix of your choice.
You can create extra users to use with the MySQL interface if, for example, you need to apply extra settings.
-
Optional - create a settings profile to apply for your custom user. For example,
my_custom_profilewith an extra setting which will be applied by default when we connect with the user we create later:prefer_column_name_to_aliasis used just as an example, you can use other settings there. -
Create a user using the following format:
mysql4<subdomain>_<username>(see above). The password must be in double SHA1 format. For example:or if you want to use a custom profile for this user:wheremy_custom_profileis the name of the profile you created earlier. -
Grant the new user the necessary permissions to interact with the desired tables or databases. For example, if you want to grant access to
system.query_logonly: - Use the created user to connect to your ClickHouse Cloud service with the MySQL interface.
Troubleshooting multiple MySQL users in ClickHouse Cloud
If you created a new MySQL user, and you see the following error while connecting via MySQL CLI client:mysql4<subdomain>_<username> format, as described (above).
Enabling the MySQL interface on self-managed ClickHouse
Add the mysql_port setting to your server’s configuration file. For example, you could define the port in a new XML file in yourconfig.d/ folder:
Connect MySQL to ClickHouse
The following command demonstrates how to connect the MySQL clientmysql to ClickHouse:
- prepared queries aren’t supported
- some data types are sent as strings
KILL QUERY connection_id statement (it is replaced with KILL QUERY WHERE query_id = connection_id while proceeding). For example: