TheRobotLearns Platform · ProxySQL: from first install to production

The mysql-default_* Variable Family

  • about 12 min read

Learning objectives

  • Search MySQL variable list for mysql-default_ names and interpret their default values.
  • Compare default entries such as mysql-default_charset, mysql-default_schema, and mysql-default_query_timeout.
  • Apply MySQL runtime and persistence rules to changes of mysql-default_* variables.

Why a default row is not live

In the sample proxysql.cnf, the mysql_variables block shows default_query_delay=0, default_query_timeout=36000000, and default_schema set to information_schema. For the Docker example, the guide mounts a chosen configuration file to /etc/proxysql.cnf. It also states that, before the first start, the operator edits /etc/proxysql.cnf, replaces the sample Admin credentials, restricts admin_variables.mysql_ifaces to trusted interfaces, reviews every other listener, and starts the service only after those settings are in place.

What the list shows

The source text shows a sample proxysql.cnf configuration under the Docker section. In the mysql_variables block, it includes default_schema with the value information_schema and default_query_timeout with the value 36000000. The same block also includes other assignments: threads with 4, max_connections with 2048, default_query_delay with 0, have_compress with true, poll_timeout with 2000, interfaces with 0.0.0.0:6033, stacksize with 1048576, server_version with 5.5.30, connect_timeout_server with 3000, monitor_username with monitor, monitor_password with monitor, monitor_history with 600000, monitor_connect_interval with 60000, monitor_ping_interval with 10000, monitor_read_only_interval with 1500, monitor_read_only_timeout with 500, ping_interval_server_msec with 120000, ping_timeout_server with 500, commands_stats with true, sessions_sort with true, and connect_retries_on_failure with 10.

Takeaway: The names and values above are taken from the sample mysql_variables block in the source text.

Search the variable names

In the development/testing sample proxysql.cnf, search the mysql_variables section. The sample shows threads with 4, max_connections with 2048, default_query_delay with 0, default_query_timeout with 36000000, have_compress with true, poll_timeout with 2000, interfaces with 0.0.0.0:6033, default_schema with information_schema, stacksize with 1048576, server_version with 5.5.30, connect_timeout_server with 3000, monitor_history with 600000, monitor_connect_interval with 60000, monitor_ping_interval with 10000, monitor_read_only_interval with 1500, monitor_read_only_timeout with 500, ping_interval_server_msec with 120000, ping_timeout_server with 500, commands_stats with true, sessions_sort with true, and connect_retries_on_failure with 10.

The same sample also shows monitor_username with monitor and monitor_password with monitor. It also includes an admin_variables section where admin_credentials is admin:admin;radmin:radmin and mysql_ifaces is 0.0.0.0:6032.

Takeaway: Match each variable name in the sample mysql_variables section to the value shown in its assignment in the same section.

Empty, NULL, deprecated, and load steps

ProxySQL configuration examples use proxysql.cnf. Example mysql_variables settings include default_query_delay=0, default_query_timeout=36000000, poll_timeout=2000, have_compress=true, connect_retries_on_failure=10, commands_stats=true, and sessions_sort=true. Example admin_variables settings include admin_credentials and mysql_ifaces.

A generic tarball does not create the service account, install files into system paths, or register the service; the operator owns those steps and the upgrade/rollback procedure. Before the first start, edit /etc/proxysql.cnf, replace the sample Admin credentials, restrict admin_variables.mysql_ifaces to trusted interfaces, review every other listener, install log rotation as appropriate, confirm file ownership, and start ProxySQL only after those security settings are in place. If lib/proxysql/ is present, install its contents under /usr/lib/proxysql/ and configure only the plugins you intend to load.

Takeaway: Review the example proxysql.cnf values, make the required security changes before the first start, and configure only the plugins you intend to load.

Print three defaults from the list

-- Print three rows from the List of MySQL Variables that begin with mysql-default_
SELECT * FROM (
  SELECT 'mysql-default_charset' AS variable_name, 'utf8' AS default_value
  UNION ALL
  SELECT 'mysql-default_schema', 'information_schema'
  UNION ALL
  SELECT 'mysql-default_query_timeout', '86400000'
) AS default_rows
WHERE LEFT(variable_name, 14) = 'mysql-default_';

The UNION ALL rows reproduce three values from the List of MySQL Variables: mysql-default_charset with utf8, mysql-default_schema with information_schema, and mysql-default_query_timeout with 86400000. The WHERE clause keeps rows whose first 14 characters are mysql-default_. The output shows those three rows as variable_name and default_value columns.

Sources

Do more with an account

The mysql-default_* Variable Family — ProxySQL: from first install to production