MySQL and PostgreSQL Startup Controls
ProxySQL starts the MySQL and PostgreSQL components by default. In ProxySQL 3.0.13, 3.1.13, and 4.0.13, you can choose which client listeners, SQL Admin listeners, and backend monitors to start for each protocol. For a deployment that uses only one database protocol, you can disable all three components for the other protocol while keeping them enabled for the one you use.
Startup settings
| Command-line option | Configuration file key | What it controls |
|---|---|---|
--mysql-workers | mysql-workers | MySQL client listeners and the workers that handle client connections |
--mysql-admin | mysql-admin | SQL Admin listeners that use the MySQL protocol |
--mysql-monitor | mysql-monitor | MySQL backend monitoring |
--pgsql-workers | pgsql-workers | PostgreSQL client listeners and the workers that handle client connections |
--pgsql-admin | pgsql-admin | SQL Admin listeners that use the PostgreSQL protocol |
--pgsql-monitor | pgsql-monitor | PostgreSQL backend monitoring |
All six settings default to true. In the configuration file, put the keys at the top level, outside mysql_variables, pgsql_variables, and admin_variables. Use unquoted true or false.
Command-line options accept true, false, 1, or 0 in either form, such as --mysql-workers=false or --mysql-workers false. Explicit options override the corresponding configuration keys. If you repeat an option, ProxySQL uses its last value. An explicit monitor option also overrides --no-monitor (-M) for that protocol. For example, -M --pgsql-monitor=true permits only the PostgreSQL monitor to start.
PostgreSQL-only deployment
Keep the PostgreSQL client and Admin listeners and backend monitor enabled. Add these keys to your ProxySQL configuration file.
mysql-workers=false;
mysql-admin=false;
mysql-monitor=false;
pgsql-workers=true;
pgsql-admin=true;
pgsql-monitor=true;
You can also pass the same settings when launching ProxySQL.
proxysql --config /etc/proxysql.cnf \
--mysql-workers=false --mysql-admin=false --mysql-monitor=false \
--pgsql-workers=true --pgsql-admin=true --pgsql-monitor=true
From the PostgreSQL Admin listener, check that the MySQL worker count is 0.
SELECT Variable_Value FROM stats_mysql_global
WHERE Variable_Name = 'MySQL_Thread_Workers';
MySQL-only deployment
Keep the MySQL client and Admin listeners and backend monitor enabled. Add these keys to your ProxySQL configuration file.
mysql-workers=true;
mysql-admin=true;
mysql-monitor=true;
pgsql-workers=false;
pgsql-admin=false;
pgsql-monitor=false;
You can also pass the same settings when launching ProxySQL.
proxysql --config /etc/proxysql.cnf \
--mysql-workers=true --mysql-admin=true --mysql-monitor=true \
--pgsql-workers=false --pgsql-admin=false --pgsql-monitor=false
From the MySQL Admin listener, check that the PostgreSQL worker count is 0.
SELECT Variable_Value FROM stats_pgsql_global
WHERE Variable_Name = 'PgSQL_Thread_Workers';
Applying changes
The startup settings stay in effect for the life of the ProxySQL process. PROXYSQL START, PROXYSQL RESTART, and PROXYSQL STOP followed by PROXYSQL START all retain them. To change the settings, relaunch ProxySQL with the new configuration or command-line values. Disabling a worker component preserves its configured mysql-threads or pgsql-threads value for a future launch.
Either SQL Admin protocol can manage both MySQL and PostgreSQL configuration. Leave at least one Admin protocol enabled if you use --no-start and intend to issue PROXYSQL START. If you issue PROXYSQL STOP, reconnect to Admin before issuing PROXYSQL START.
The mysql-monitor_enabled and pgsql-monitor_enabled runtime variables control whether a monitor runs checks. To run checks for a protocol, its monitor must be allowed to start and its runtime variable must be true.
See ProxySQL Startup Options for the full list of command-line flags.