All pages
Powered by GitBook
1 of 4

Loading...

Loading...

Loading...

Loading...

Client/Server Protocol

Find detailed descriptions in the Reference section:

Client/Server Protocol

Client Libraries

Explore server and client software for MariaDB. This section introduces various tools and applications for connecting to, managing, and interacting with your MariaDB Server instances effectively.

Proxy Protocol Support

The proxy protocol allows proxy programs to relay the IP addresses of the clients to the server programs. It is important in the case of MariaDB, since IP information is actually a part of user identity.

How Proxy Protocol Works

As per the proxy protocol specification, the connecting client can prefix its first packet with a proxy protocol header. The server will parse the header and assume the client's IP address is the one set in the proxy header.

For example, if a client sends the proxy header (V1, text) which is "PROXY TCP4 192.168.0.1 192.168.0.11 56324 443\r\n", the server, after parsing, assumes the client's IP is 192.168.0.1

MariaDB server understands both Version 1 (text) and Version 2 (binary) of the proxy header.

If the protocol specified by the version 1 header is "UNKNOWN", the MariaDB server will treat the connection as if the proxy protocol was disabled. This can be used when a valid proxy protocol header is needed, but there is no client to proxy, for example, when a proxy does a health check.

Enabling Proxy Protocol in MariaDB Server

To enable use of the proxy protocol, it is necessary to specify subnetworks that are allowed to send proxy headers, using the server variable.

is either a comma-separated list of or IP addresses. One can also use 'localhost' in this list, which means Unix domain socket/named pipe/shared memory connections are allowed as well. Or proxy-protocol-networks can be set to *, meaning that proxy headers are allowed from any client.

Note that a client running on a host within an allowed proxy network or an IP address can itself pretend to be connected from any IP address whatsoever and thus can possibly impersonate other users. Generally, you should limit shell access to proxy hosts to a minimum. And remember, with proxy-protocol-networks=* every host is a proxy host.

Example in my.ini/my.cnf

allows IPv6 connections from local machine ::1, from IP addresses starting with 192.168, and from connections made with Unix domain sockets or named pipes.

Client-Side Support for Proxy Protocol

Since the functionality is suited only to very specific proxy-like programs, most client APIs do not provide support for sending proxy headers. One exception is version 3 or later. One can now use :

prior to or mysql_connect(), to send the header. In the call above, _header_ is the proxy header with the type void *, and _header_size_ is its size in bytes (type is size_t).

Example

Using Proxy Protocol with MariaDB MaxScale

If you want to use proxy protocol with MaxScale:

  • Add the IP address of the MaxScale server to

  • In maxscale.cnf, add the parameter for all configured servers

Once configured, MaxScale will proxy the credentials from the client to the server.

See Also

This page is licensed: CC BY-SA / Gnu FDL

proxy-protocol-networks
proxy-protocol-networks
(sub) networks
proxy-protocol-networks
proxy_protocol
Proxy Protocol
proxy-protocol-networks=::1, 192.168.0.0/16, localhost
mysql_optionsv(mysql, MARIADB_OPT_PROXY_HEADER, header,  header_size)
const char *hdr="PROXY TCP4 192.168.0.1 192.168.0.11 56324 443\r\n";
mysql_optionsv(mysql, MARIADB_OPT_PROXY_HEADER, hdr,  strlen(hdr));

Connect and Query

Database connections are made using a connector (from an application) or a client (interactively or from scripts).

Clients and connectors listed here are supported under MariaDB Corporation Engineering Policies.

Clients and connectors listed here are compatible with:

  • MariaDB database products (including Enterprise Server and MaxScale)

  • MariaDB Community Server

MariaDB Connectors

MariaDB Connectors are available for many popular programming languages.

Programming Language / Interface
Connector

MariaDB Client

MariaDB Client can be used interactively or within scripts.

MariaDB Client is included with distributions of MariaDB database products.

Compatible third-party clients exist but are not listed here.

Executable Filename
Purpose

For additional information about MariaDB Client, see MariaDB Client.

Tools and Utilities

Tools and utilities listed here are included with distributions of MariaDB database products and make a client connection.

Command-Line Executable
Purpose

Business Intelligence (BI)

MariaDB database products are accessible from business intelligence (BI) platforms, including:

BI Platform
Detail

This page is: Copyright © 2025 MariaDB. All rights reserved.

Python

mariadb-show, mysqlshow

Display databases, tables, table columns, indexes

mariadb-slap, mysqlslap

Generate client load for testing

C

C++

Java - JDBC

Java - R2DBC

JavaScript

ODBC

mariadb, mysql

Connect from the command line

mariadb-admin, mysqladmin

Check configuration and current status

mariadb-backup, mariadb-backup

Create and restore physical backups (including Aria, InnoDB, MyISAM, MyRocks)

mariadb-binlog, mysqlbinlog

Read binary logs or relay logs

mariadb-check, mysqlcheck

Perform table maintenance operations

mariadb-dump, mysqldump

Create logical backups

mariadb-import, mysqlimport

Load table data from CSV, TSV, and other text file formats

Microsoft Power BI

MariaDB Direct Query Adapter for Microsoft Power BI enables Microsoft Power BI Desktop users to remotely connect to and query their MariaDB database, including on MariaDB MariaDB Cloud, without downloading the entire data set to their local machine.

Connector/C
mysql_optionsv()
mysql_real_connect()
MariaDB Connector/C
MariaDB Connector/C++
MariaDB Connector/J
MariaDB Connector/R2DBC
MariaDB Connector/Node.js
MariaDB Connector/ODBC
MariaDB Connector/Python