Skip to main content

Admin Backups

Overview

ProxySQL Admin data can be backed up using three methods: file-based backups, SQLite backups, and mysqldump exports.

Backup Methods

File Backups

The simplest approach involves copying the disk-persisted database file directly. The system enforces a database-level lock to ensure consistency:

cp /var/lib/proxysql/proxysql.db /var/lib/proxysql/proxysql-backup.db

SQLite Backups

Two SQLite-based options are available.

Dump file method:

sqlite3 /var/lib/proxysql/proxysql.db .dump > /var/lib/proxysql/proxysql-dump.sql

Backup file method:

sqlite3 /var/lib/proxysql/proxysql.db ".backup 'proxysql-backup.sq3'"

mysqldump Method

Users can export specific or all ProxySQL Admin tables. Required flags include --no-tablespaces, --skip-triggers, and --skip-add-locks.

Example for exporting the mysql_servers table:

mysqldump -u admin -padmin -h 127.0.0.1 -P6032 \
--no-tablespaces --skip-triggers -t main mysql_servers \
--skip-column-statistics > /tmp/dump_servers.sql

Version 8.0 Requirements

When using mysqldump version 8.0, the --skip-column-statistics flag is mandatory and requires ProxySQL version 2.0.8 or later.