proxysql
Proxysql Overview
Secure your stack with a hardened Proxysql image freshly-built by Minimus. Minimus images always include the most up-to-date package version for all packages and dependencies contained in the image.
ProxySQL is an open-source MySQL proxy that sits between applications and database servers to manage connections, route queries, and optimize performance. It provides connection pooling, query caching, load balancing across multiple backends, and advanced routing rules based on query patterns and user credentials. ProxySQL also enables traffic management, query rewriting, and failover capabilities without requiring changes to application code.
Try It Out
Spin up ProxySQL in front of a MySQL backend with Docker Compose. This demonstrates using ProxySQL's admin interface to register a backend server and route client traffic to it.
Create a Docker Compose File
Save the following to a proxysql-compose.yaml file in your working directory:
services:
mysql:
image: reg.mini.dev/mysql:latest
environment:
MYSQL_ROOT_PASSWORD: Minimus!
healthcheck:
test: ["CMD-SHELL", "mysqladmin ping -h 127.0.0.1 -uroot -pMinimus!"]
interval: 5s
timeout: 5s
retries: 10
proxysql:
image: reg.mini.dev/proxysql:latest
depends_on:
mysql:
condition: service_healthy
ports:
- "6032:6032"
- "6033:6033"
client:
image: reg.mini.dev/mariadb:latest
entrypoint: ["mariadb"]
network_mode: "service:proxysql"
profiles: ["tools"]Start the Services
docker compose -f proxysql-compose.yaml up -dWait for the backend to become healthy:
docker compose -f proxysql-compose.yaml psRegister the Backend Server
Connect to ProxySQL's admin interface (default credentials are admin/admin) and register the MySQL backend as a server in hostgroup 10, then add a user ProxySQL will authenticate client connections as. ProxySQL's admin user only accepts connections from 127.0.0.1 as a security default, and the admin interface requires the mysql_native_password authentication plugin, which recent MySQL client libraries no longer ship. The client service below works around both: network_mode: "service:proxysql" puts it inside ProxySQL's own network namespace so 127.0.0.1 reaches it as a local connection, and it's a MariaDB client, which still supports mysql_native_password, instead of a mysql client:
docker compose -f proxysql-compose.yaml run --rm client -h 127.0.0.1 -P 6032 -u admin -padmin -e "
INSERT INTO mysql_servers(hostgroup_id, hostname, port) VALUES (10, 'mysql', 3306);
INSERT INTO mysql_users(username, password, default_hostgroup) VALUES ('root', 'Minimus\!', 10);
LOAD MYSQL SERVERS TO RUNTIME;
SAVE MYSQL SERVERS TO DISK;
LOAD MYSQL USERS TO RUNTIME;
SAVE MYSQL USERS TO DISK;
"Connect Through ProxySQL
Query the MySQL backend through ProxySQL's client interface on port 6033, instead of connecting to the backend directly:
docker compose -f proxysql-compose.yaml run --rm client -h 127.0.0.1 -P 6033 -u root -pMinimus\! -e "show databases;"ProxySQL forwards the query to the backend server and returns the result set:
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+Confirm Traffic Routed Through ProxySQL
Check ProxySQL's connection pool stats to confirm the query above was actually routed to the backend server rather than served directly:
docker compose -f proxysql-compose.yaml run --rm client -h 127.0.0.1 -P 6032 -u admin -padmin -e "SELECT hostgroup, srv_host, srv_port, Queries FROM stats_mysql_connection_pool;"+-----------+----------+----------+---------+
| hostgroup | srv_host | srv_port | Queries |
+-----------+----------+----------+---------+
| 10 | mysql | 3306 | 1 |
+-----------+----------+----------+---------+Clean Up
Stop and remove all containers and volumes:
docker compose -f proxysql-compose.yaml down -vTechnical Considerations
The Proxysql image provided by Minimus is a slim, security-hardened alternative to the public image from Docker Hub. The images are largely interchangeable, with a few differences as noted below.
Proxysql built by Minimus:
- Drill down on the version specification tab to see the default user, listening ports, entrypoint, volumes, environment variables, etc.
The Payoff
A hardened, minimal image that will remain more secure for the long run and accrue vulnerabilities at a slower rate.
- See the risk reduction dashboard for a detailed CVE comparison over the past 30 days.
- Review the compliance report to see the default hardening and security configurations for the image.
Terms & Info
Trademark
This catalog is published by Minimus. All product names, logos, and marks, other than those belonging to Minimus, shown are owned by their respective rights holders and appear here only to identify the open source software each image contains. Minimus claims no ownership of those marks and implies no affiliation with, endorsement by, certification by, or sponsorship by any rights holder.
Disclaimer
Images are provided "as-is" without warranty of any kind. "Hardened" refers to the security configuration applied at the time of build and does not constitute a guarantee of ongoing security or absence of vulnerabilities. The free tier is provided without support, SLA, or guaranteed patching timelines. Security updates may be applied to paid subscriptions before or instead of free tier images. By pulling or using any image you agree to our Terms of Use.