Skip to main content
Last updated on

Connecting via MySQL Protocol

Apache Doris is fully compatible with the MySQL network communication protocol. As a result, all client tools, visualization tools, and MySQL drivers / libraries for mainstream programming languages that follow this protocol can connect to Doris directly, without installing any Doris-specific driver.

Doris FE provides MySQL protocol service on port 9030 by default, which corresponds to the query_port configuration item in fe.conf.

Typical Use Cases​

Based on the purpose of use, MySQL protocol connections fall into two typical scenarios:

ScenarioTypical UseRecommended Approach
Command-line / Script AccessOperations troubleshooting, ad hoc queries, automation scriptsMySQL CLI
Application IntegrationBackend services, data processing programs, ETL jobsMySQL drivers for the corresponding language (Java / Go / Rust / Python / C++, etc.)

Preparation Before Connecting​

Before establishing a connection, confirm the following information:

ItemDescriptionExample
FE_IPIP address or hostname of the Doris FE node172.20.63.118
FE_QUERY_PORTFE MySQL protocol service port, corresponding to query_port in fe.conf9030
USERLogin accountroot
PASSWORDLogin password (the default root account has an empty password)-

If you need to customize the port, modify the query_port configuration item in fe.conf on the FE node accordingly and restart FE.

Connection Examples​

The following provides minimal connection examples for different MySQL clients / language drivers. Switch between them using the tabs below:

Suitable for scenarios such as command-line operations, ad hoc queries, and scripted invocations.

1. Download and Extract the MySQL Client​

Download the MySQL client from the MySQL official website. Doris is compatible with MySQL 5.7 and later client versions.

After extracting, you can find the mysql command-line tool in the bin/ directory.

2. Connect to Doris​

Run the following command to connect to Doris:

mysql -h FE_IP -P FE_QUERY_PORT -u USER -p

After pressing Enter, type the password (the root account has no password by default, so just press Enter).

3. Verify Login​

Once login succeeds, you will see the following message:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 236
Server version: 5.7.99 Doris version doris-2.0.3-rc06-37d31a5

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>