Bring your database changes with you, without touching phpMyAdmin manually.

TL;DR
- Install WP Staging SQL Recorder.
- Click Start Recording in Tools → SQL Recorder.
- Perform the changes you want copied.
- Click Stop Recording and download the
.sql
file. - Import that file on the destination site via WP‑CLI or phpMyAdmin.
Purpose: Perfect for staging → production deployments, debugging, or cloning a site while keeping content edits in sync.
Why Record SQL Queries?
- Granular migrations – Move only the changes you just made, not a full DB dump.
- Audit trail – See exactly what SQL runs when a plugin or theme saves data.
- Debugging – Re‑produce tricky bugs on a dev site by replaying the queries.
Prerequisites
- WordPress 5.8+ (tested up to 6.8.2).
- Admin access on both the source and target sites.
- The free WP Staging SQL Recorder plugin (download link below).
- Basic database import permissions (WP‑CLI or phpMyAdmin).
Step‑by‑Step Guide
1. Install & Activate the Plugin
- 🚀 Download
wp-sql-recorder.zip
from github. - Go to Plugins → Add New → Upload Plugin.
- Upload the ZIP, click Install Now, then Activate.
2. Start Recording
- Navigate to Tools → SQL Recorder.
- Hit Start Recording.
- A green banner confirms that recording is active and shows the filename, e.g.
wp-sql-20250716-153045.sql
.


3. Perform Your Changes
Anything that triggers INSERT
, UPDATE
, DELETE
, CREATE
, or ALTER
statements is captured. Examples:
- Publishing new posts or pages.
- Installing a theme that creates custom tables.
- Running a plugin’s data migration wizard.
⚠️ SELECT queries are skipped to keep the dump import‑safe and compact.
4. Stop & Download the File
- Return to Tools → SQL Recorder.
- Click Stop Recording.
- A button appears to Download SQL file.
The file lives temporarily in /wp-content/uploads/sql-recordings/
—handy for scripting.
5. Transfer the SQL File to Your Destination Server
# Example via scp
scp wp-sql-20250716-153045.sql user@prod:/var/www/html/
6. Import on the Target Site
A. Using WP‑CLI (Recommended)
wp db import wp-sql-20250716-153045.sql
WP‑CLI automatically uses the credentials in wp-config.php
.
B. Using phpMyAdmin / Adminer
- Open the site’s database in phpMyAdmin.
- Click Import, choose the file, and start.
Prefix mismatch? If your target site uses a different table prefix (
wp_
→wp7_
), run a quick search‑and‑replace before importing:sed -i 's/`wp_/`wp7_/g' wp-sql-*.sql
Automating the Workflow
Need to deploy nightly? Pair WP SQL Recorder with a cron‑driven WP‑CLI script:
wp option update wpsr_recording 1 # start
sleep 3600 # ...one hour of edits
wp option update wpsr_recording 0 # stop
FILE=$(wp option get wpsr_current_file)
wp db export "$FILE" # optional safety copy
rsync -avz "$FILE" prod:/var/www/html/sql/
ssh prod "wp --path=/var/www/html db import sql/$(basename $FILE)"
Troubleshooting
Symptom | Fix |
---|---|
File won’t download | Ensure uploads/sql-recordings/ is writable (permissions 755 ). |
Import fails with foreign‑key errors | Import during low traffic or disable FK checks: SET FOREIGN_KEY_CHECKS=0; before the dump. |
Nothing is recorded | Confirm recording is ON and you performed actions that write to the DB. |
Frequently Asked Questions
Does it slow down my site?
Minimal. Each write query is appended to a file with LOCK_EX
. On high‑write sites, consider enabling it only during deployment windows.
Can I filter specific tables?
Not yet, but it’s on our roadmap. Star the repo to get updates!
Is the dump compatible with MariaDB?
Yes—queries are captured exactly as MySQL/MariaDB receives them.
Next Steps & Call to Action
- Download WP SQL Recorder → Plugin Page ›
- Subscribe to our newsletter for more WordPress dev tips.
- Share this article! It helps other developers and boosts our content reach.
Did this guide save you time? Tweet us your success story with #WP Staging SQLRecorder.