ProxySQL MySQL MySQL · DBA · Configuration

ProxySQLRuntime vs Memory vs Disk

Deep dive into ProxySQL three-layer configuration system. Understand RUNTIME, MEMORY and DISK layers, the Load/Save workflow, and how to revert changes.

ProxySQL uses a unique three-layer configuration system. Understanding this is essential to managing ProxySQL correctly. Each layer has a specific role:

LayerLocationPersistentWhen Active
RUNTIMEIn-memory (ProxySQL threads)NoAlways — current live config
MEMORY (main)In-memory SQLiteNoStaging — only after LOAD
DISK/var/lib/proxysql/proxysql.dbYesOn startup — loaded into MEMORY
  ┌────────────────────────────────────────────────────────────────┐
  │  DISK (proxysql.db)  ←──── SAVE ... TO DISK                   │
  │         │                                                      │
  │         │  (on startup)                                        │
  │         ▼                                                      │
  │  MEMORY (main db)    ←──── Admin edits go here first          │
  │         │                                                      │
  │         │  LOAD ... TO RUNTIME                                 │
  │         ▼                                                      │
  │  RUNTIME             ←──── What ProxySQL actually uses        │
  └────────────────────────────────────────────────────────────────┘

The correct workflow for any configuration change is always:

  1. Connect to Admin interface (port 6032)
  2. Make changes to MEMORY (INSERT/UPDATE/DELETE on main tables)
  3. Run LOAD ... TO RUNTIME (activates changes immediately)
  4. Run SAVE ... TO DISK (persists changes across restarts)
SQL — Correct Change Workflow
-- Example: Add a MySQL server and make it live + persistent

-- Step 1: Edit MEMORY
INSERT INTO mysql_servers (hostgroup_id, hostname, port)
VALUES (10, '192.168.1.100', 3306);

-- Step 2: Activate in RUNTIME
LOAD MYSQL SERVERS TO RUNTIME;

-- Step 3: Persist to DISK
SAVE MYSQL SERVERS TO DISK;

You can always inspect what is currently active in RUNTIME using the runtime_ prefixed tables:

SQL — Query RUNTIME Tables
-- See what servers are ACTUALLY running right now
SELECT * FROM runtime_mysql_servers;

-- See active query rules
SELECT * FROM runtime_mysql_query_rules;

-- See active users
SELECT * FROM runtime_mysql_users;

-- See active global variables
SELECT * FROM runtime_global_variables;

-- See active checksums (useful for ProxySQL cluster)
SELECT * FROM runtime_checksums_values;
💡 Note: If RUNTIME and MEMORY differ, it means you made changes but forgot to run LOAD ... TO RUNTIME. Always check runtime_ tables to verify what is actually live.
MistakeConsequenceFix
Changed main table but forgot LOADChange not active — ProxySQL still uses old configLOAD ... TO RUNTIME
Ran LOAD but forgot SAVEChange lost after ProxySQL restartSAVE ... TO DISK
Edited proxysql.cnf directlyChanges ignored — ProxySQL reads proxysql.db on startUse Admin interface instead
Restarted without SAVEAll unsaved changes rolled back to last DISK stateAlways SAVE after changes
SQL — Revert Changes
-- Revert MEMORY to current RUNTIME state (undo unsaved edits)
LOAD MYSQL SERVERS FROM RUNTIME;

-- Revert MEMORY to last saved DISK state
LOAD MYSQL SERVERS FROM DISK;

-- Revert RUNTIME to DISK state (emergency rollback)
LOAD MYSQL SERVERS FROM DISK;
LOAD MYSQL SERVERS TO RUNTIME;

The config file is only read on the very first start when no proxysql.db exists. After that, ProxySQL always reads from the SQLite database. The config file is useful for initial bootstrap only.

BASH — Reset to Config File
# Force ProxySQL to re-read the config file (wipes existing DB)
systemctl stop proxysql
rm /var/lib/proxysql/proxysql.db
systemctl start proxysql
⚠ Warning: This wipes your entire ProxySQL configuration. Only do this in development or when intentionally resetting.