TheRobotLearns Platform · ProxySQL: from first install to production
Admin Database Backup Methods
Learning objectives
- Create a file-level backup by copying `/var/lib/proxysql/proxysql.db` and understand that the documented file copy relies on the enforced database-level lock for consistency.
- Produce SQLite-based backup artifacts using the `.dump` method for a SQL dump or the `.backup` method for a backup file.
- Export selected ProxySQL Admin tables from the `main` schema with `mysqldump` through the documented Admin interface, using connection parameters such as `127.0.0.1:6032` and `admin` credentials in the example.
- Apply the documented required `mysqldump` flags `--no-tablespaces`, `--skip-triggers`, and `--skip-add-locks`, and use `--skip-column-statistics` for the documented mysqldump 8.0 condition.
- Explain that backup methods preserve DISK-layer state, so unsaved MEMORY changes are not included unless first saved to DISK.
Copy the disk file directly
The simplest backup copies the disk-persisted database file directly. ProxySQL stores that file at /var/lib/proxysql/proxysql.db and treats it as the DISK layer. The file copy is consistent because the system enforces a database-level lock.
Run this command to create a copied database file at the target path:
cp /var/lib/proxysql/proxysql.db /var/lib/proxysql/proxysql-backup.dbSQLite backups use two options. They also start from /var/lib/proxysql/proxysql.db. The disk database normally mirrors persistent tables in main, with the same semantics. If a table row has no disk copy, ProxySQL loses it after restart.
Run this command to write SQL text to the target dump file:
sqlite3 /var/lib/proxysql/proxysql.db .dump > /var/lib/proxysql/proxysql-dump.sqlRun this command to create a SQLite backup file in the current directory:
sqlite3 /var/lib/proxysql/proxysql.db ".backup 'proxysql-backup.sq3'"The .dump form produces SQL text. The .backup form produces a backup file named 'proxysql-backup.sq3'. A file backup captures the DISK layer, so it will not contain a MEMORY change that has not been saved to DISK.
Takeaway: Use cp for a direct disk file, .dump for SQL text, and .backup for a SQLite backup file.
Use mysqldump for table exports
With mysqldump, you can export specific or all ProxySQL Admin tables. The main schema contains the general ProxySQL Admin tables; list them with SHOW TABLES FROM main. The exact table list may vary by ProxySQL version and operating modules.
Core general tables include global_variables, scheduler, restapi_routes, proxysql_servers, and coredump_filters; MySQL and PostgreSQL tables have their own reference sections.
To export mysql_servers from main to /tmp/dump_servers.sql, include the required flags and the example connection:
mysqldump -u admin -padmin -h 127.0.0.1 -P6032 --no-tablespaces --skip-triggers --skip-add-locks -t main mysql_servers --skip-column-statistics > /tmp/dump_servers.sqlThis command connects with -u admin -padmin -h 127.0.0.1 -P6032, names the main schema and the mysql_servers table, and includes the required --no-tablespaces, --skip-triggers, and --skip-add-locks flags. The export also adds --skip-column-statistics. When mysqldump is version 8.0, --skip-column-statistics is mandatory and requires ProxySQL version 2.0.8 or later.
Takeaway: Use mysqldump on the main table you need, include the required flags, and add --skip-column-statistics for mysqldump 8.0.
Restart, runtime, and what is saved
You load a setting to RUNTIME and query a matching runtime_ table, such as runtime_global_variables. Configuration tables with an active layer have matching runtime_ tables. Runtime tables represent configuration currently in use by ProxySQL threads. They are operational projections, not additional configuration sources.
The disk database normally mirrors persistent tables in main, with the same semantics. At restart, ProxySQL populates the corresponding in-memory tables from the disk database. Main-memory content that has no disk copy is lost. A change that is only in MEMORY and has not been written with SAVE ... TO DISK is therefore not present in a copy of /var/lib/proxysql/proxysql.db.
coredump_filters is a released exception. It selects source locations for the coredump subsystem. It exists only in main-memory and runtime layers. It has no disk or configuration table.
There is no released SAVE COREDUMP command. You reinsert desired rows after every restart before running a LOAD form.
Takeaway: For persistent backups, get rows into DISK; coredump_filters never lives there and must be recreated after restart.
List tables before backing one up
SHOW TABLES FROM main;Connect to the Admin interface, using the admin credentials and port shown in the mysqldump example. SHOW TABLES FROM main; lists the configuration and runtime tables in main. The exact list may vary by ProxySQL version and loaded modules. The mysqldump method uses the main schema and mysql_servers table. A file backup copies /var/lib/proxysql/proxysql.db, which is the DISK layer.
Sources
- Admin Backups
- Configuring ProxySQL
- Configuration Tables
- Configuration Tables
- Configuring ProxySQL
- Admin Backups
- Admin Backups
- Configuration Tables
- Configuration Tables
- Configuration Tables
- Configuration Tables
- Configuring ProxySQL
- Configuring ProxySQL
- Admin Backups
- Configuring ProxySQL
- Configuration Tables
- Configuration Tables
- Configuring ProxySQL
- Admin Backups
- Admin Backups
- Configuration Tables
- Configuration Tables
- Configuration Tables
- Configuration Tables
- Configuring ProxySQL
- Configuring ProxySQL
Do more with an account
- Graded quizzes is available on your account.
- Saving your progress is available on your account.
- Hands-on labs is available on your account.
- AI tutoring is available on your account.