Skip to content

Connect to EMQX Tables via MySQL

EMQX Tables supports the MySQL server-client protocol, allowing users and applications to connect directly for querying and managing time-series data.

This interface is fully compatible with most standard MySQL clients and drivers. It is useful for integrating with BI tools, custom applications, or running SQL queries programmatically.

All connections are encrypted with TLS, ensuring secure data transmission.

Connection Parameters

To connect to EMQX Tables in MySQL protocol, use the information below.

You can find these credentials on your EMQX Tables Deployment Overview page in the Console.

  • Host: {YOUR_EMQX_TABLES_PUBLIC_HOST}
  • Port: 4002
  • Database: {YOUR_EMQX_TABLES_DB_NAME}
  • Username: {YOUR_EMQX_TABLES_USERNAME}
  • Password: {YOUR_EMQX_TABLES_PASSWORD}

Connect via CLI

MySQL CLI

You can use the standard MySQL client to connect:

shell
mysql --ssl-mode=REQUIRED -u {USER} -p -h {HOST} -P 4002 -A {DB_NAME}

MariaDB CLI

MariaDB’s CLI supports similar syntax, with a slightly different SSL flag:

shell
mysql --ssl -u {USER} -p -h {HOST} -P 4002 -A {DB_NAME}

Connect via Applications

JDBC Connection String

Use the following JDBC URL format when connecting from Java or BI tools:

text
jdbc:mysql://{HOST}:4002/{DB_NAME}?user={USER}&password=~~{PASSWORD}~~

Python or Other Clients

For Python or other languages using MySQL-compatible libraries, use this URL format:

text
mysql://{USER}:~~{PASSWORD}~~@{HOST}:4002/{DB_NAME}