How to Sync Your WordPress Database from InstaWP to Local App
A complete guide to pulling your WordPress database from InstaWP cloud hosting to your local development environment using WP-CLI and Local by Flywheel.
Tools Required
- Local by Flywheel - Local WordPress development environment
- WP-CLI - WordPress command-line interface (included with Local and InstaWP)
- SSH/SCP - For connecting to and transferring files from InstaWP
- MySQL - Database management (included with Local)
- Terminal/Command Line - macOS Terminal, Windows PowerShell, or similar
Prerequisites
Before you begin, ensure you have:
- An active InstaWP site with SSH access enabled
- Local by Flywheel installed on your computer
- A local WordPress site created in Local
- Your InstaWP SSH credentials (host, username, password, port)
Step 1: Get Your InstaWP SSH Credentials
- Log into your InstaWP dashboard at https://app.instawp.io
- Navigate to your site
- Look for the "Connect" or "SSH/SFTP" section
- Note down the following:
- Host/IP:
yoursite.instawp.site - Port:
22 - Username:
your-username - Password: Your SSH password
- Host/IP:
Step 2: Connect to InstaWP via SSH
Open your terminal and connect to InstaWP:
ssh your-username@yoursite.instawp.site -p 22Enter your password when prompted.
Note: You may see some warnings about bash history or channel errors - these are harmless and can be ignored.
Step 3: Locate Your WordPress Installation
Once connected, find where WordPress is installed:
# Search for wp-config.php
find /home -name "wp-config.php" 2>/dev/nullThis will output something like:
/home/your-username/web/yoursite.instawp.site/public_html/wp-config.phpNavigate to that directory:
cd /home/your-username/web/yoursite.instawp.site/public_html/Verify you're in the right place:
ls -laYou should see WordPress files: wp-admin, wp-content, wp-includes, wp-config.php
Step 4: Export the Database from InstaWP
# Export the database
wp db export instawp-backup.sqlYou should see:
Success: Exported to 'instawp-backup.sql'.Step 5: Download the Database to Your Computer
Open a NEW terminal window on your local computer (keep the SSH session open).
Download the SQL file using SCP:
scp -P 22 your-username@yoursite.instawp.site:/home/your-username/web/yoursite.instawp.site/public_html/instawp-backup.sql ~/Downloads/Enter your password when prompted. The file will download to your Downloads folder.
Step 6: Open Local Site Shell
- Open Local by Flywheel
- Find your local development site in the list
- Right-click on the site name
- Select "Open Site Shell"
This opens a terminal that's pre-configured for your Local site.
Step 7: Verify WP-CLI is Working
In the Local Site Shell:
wp --infoYou should see WP-CLI version information (ignore any PHP warnings).
Step 8: Backup Your Current Local Database
Always backup before importing!
wp db export backup-before-import.sqlStep 9: Clean the SQL File (MariaDB Compatibility)
InstaWP uses MariaDB, which has a slightly different SQL format. Clean the file:
# Remove the first line (MariaDB-specific)
tail -n +2 ~/Downloads/instawp-backup.sql > ~/Downloads/instawp-backup-clean.sqlVerify the cleaned file looks correct:
head -n 5 ~/Downloads/instawp-backup-clean.sqlShould show:
-- MariaDB dump 10.19...
--
-- Host: localhost Database: ...Step 10: Check InstaWP's Table Prefix
# Look at the table names in the SQL file
head -n 50 ~/Downloads/instawp-backup-clean.sql | grep "Table structure"Note the prefix (e.g., iwpfe4a_, wp_, etc.). You'll need this for the next step.
Step 11: Update Your Local wp-config.php
Your local site needs to use the same table prefix as InstaWP.
# Open wp-config.php in your default editor
open ~/Local\ Sites/yoursite/app/public/wp-config.phpFind this line:
$table_prefix = 'wp_';Change it to match InstaWP's prefix:
$table_prefix = 'iwpfe4a_'; // Use the prefix you found in Step 10Save and close the file.
Step 12: Get Your Local Database Name
wp config get DB_NAMEThis will output your database name (usually local or something similar).
Step 13: Import the Database
Reset your database and import the InstaWP data:
# Drop all existing tables
wp db reset --yes
# Import using MySQL directly (more reliable than wp db import)
mysql -u root your-database-name < ~/Downloads/instawp-backup-clean.sqlNote: Replace your-database-name with the name from Step 12.
If prompted for a password, try root or just press Enter.
Step 14: Verify the Import
wp db tablesYou should now see tables with InstaWP's prefix (e.g., iwpfe4a_posts, iwpfe4a_options, etc.).
Step 15: Search-Replace URLs (CRITICAL!)
This replaces all hardcoded URLs in your database.
Dry run first (see what will change):
wp search-replace 'https://yoursite.instawp.site' 'http://yoursite.local' --all-tables --dry-runReplace with your actual URLs:
https://yoursite.instawp.site= Your InstaWP production URLhttp://yoursite.local= Your Local development URL
Step 16: Clear Cache and Flush Permalinks
wp cache flush
wp rewrite flushStep 17: Test Your Site
In Local app, click "Open Site" or visit your local URL in a browser.
Your InstaWP site should now be running locally!
Troubleshooting
"ERROR 1064: SQL syntax error"
If you get this error with wp db import, use MySQL directly:
mysql -u root your-database-name < ~/Downloads/instawp-backup-clean.sql"Table prefix doesn't match"
Make sure you updated wp-config.php with the correct $table_prefix from InstaWP's database.
PHP Extension Warnings
If you see warnings about opcache.so, imagick.so, or xdebug, you can safely ignore them. They don't affect WP-CLI functionality.
To remove them permanently:
# Open Local's PHP config
open "/Users/your-username/Library/Application Support/Local/run/XXXXXXX/conf/php/php.ini"Comment out these lines by adding ; at the start:
;extension=imagick.so
;extension=opcache.so
;zend_extension=xdebug.soSave and restart your site in Local.
Site Still Shows InstaWP URLs
Make sure you ran the wp search-replace command in Step 15. You can run it again if needed.
Can't Find wp-config.php on InstaWP
InstaWP paths vary. Try:
cd ~
find . -name "wp-config.php" 2>/dev/nullFuture Syncs - Quick Reference
Once you've done this once, future syncs are faster:
# 1. ON INSTAWP (via SSH)
cd /home/your-username/web/yoursite.instawp.site/public_html/
wp db export instawp-backup.sql
# 2. ON YOUR COMPUTER (download)
scp -P 22 your-username@yoursite.instawp.site:/home/your-username/web/yoursite.instawp.site/public_html/instawp-backup.sql ~/Downloads/
# 3. IN LOCAL SITE SHELL
tail -n +2 ~/Downloads/instawp-backup.sql > ~/Downloads/instawp-backup-clean.sql
wp db reset --yes
mysql -u root local < ~/Downloads/instawp-backup-clean.sql
wp search-replace 'https://yoursite.instawp.site' 'http://yoursite.local' --all-tables
wp cache flush && wp rewrite flushAutomation Option
For frequent syncs, consider creating a bash script based on this tutorial that automates the entire process.
Summary
You've successfully:
- β Connected to InstaWP via SSH
- β Exported the production database
- β Downloaded it to your local machine
- β Imported it into Local app
- β Updated all URLs with search-replace
- β Set up your local development environment with production data
Your local site now mirrors your InstaWP production site, and you can develop with real data!