Manual WordPress Database Restoration Without Plugins: Step-by-Step Guide

Direct Answer: How to Manually Restore WordPress Database Without Plugins

To manually restore your WordPress database without using plugins, you primarily use a database management tool such as phpMyAdmin or command-line access (like MySQL CLI) to import a previously exported SQL database file. In addition, you may need FTP or hosting file manager access to upload WordPress core files or themes if necessary. This process bypasses plugin interfaces by directly handling the database and site files.

Prerequisites and Safety Checks Before Manual Restoration

Manual restoration involves direct operations on your database and site files, so ensure the following prerequisites and safety checks:

  • Backup Current Data: Before restoring, make a fresh backup of your current database and WordPress files in case of restoration failure or data loss.
  • Database Backup File: Have your WordPress database backup file ready in .sql or compressed format. This file comes from previous exports or full site backups.
  • Access Credentials: Confirm you have:
    • Database credentials (host, username, password, database name)
    • FTP or hosting file manager credentials to access WordPress files
    • phpMyAdmin or SSH access to your database server
  • Check Database Compatibility: The backup file should be compatible with your current MySQL/MariaDB server version to avoid import errors.
  • Restore Plan: Identify if you’re restoring just the database or both files and database, as restoring files involves FTP operations.
  • Site Downtime: Prepare for site downtime while restoring to avoid user confusion or data conflicts.

Step-by-Step Manual WordPress Database Restoration

BSoD in Windows Server 2016 till Windows Server version 1909 (server core).png
Image: Wikimedia Commons · Microsoft · Public domain

Step 1: Access Your Hosting Environment

Login to your hosting control panel (like cPanel, Plesk) or connect via FTP to access WordPress files. Open the database management tool phpMyAdmin or SSH client for command-line access.

Step 2: Backup Current Database

If possible, export the current database as a safety backup:

  • In phpMyAdmin, select your WordPress database, click “Export,” choose “Quick” and “SQL,” then download the file.
  • In command line: mysqldump -u username -p database_name > backup_current.sql

Step 3: Delete Existing Database Content

You need to empty or drop all tables before importing to avoid conflicts.

  • In phpMyAdmin, select all tables and choose “Drop” or “Empty” to remove content.
  • In command-line:
  • mysql -u username -p
    USE database_name;
    SHOW TABLES;
    -- For each table:
    DROP TABLE tablename;

Step 4: Import the Database Backup

Using phpMyAdmin:

  • Go to the database, click “Import” tab.
  • Click “Choose File” and select your .sql or compressed backup file.
  • Click “Go” to start import. Wait until you see a success message.

Using MySQL command line:

mysql -u username -p database_name < path_to_backup.sql

Step 5: Restore WordPress Files via FTP (If Applicable)

If you need to restore themes, plugins, or uploads alongside the database:

  • Connect to your site via FTP (using clients like FileZilla).
  • Upload the backed-up wp-content folder, wp-config.php, and any other modified core files.
  • Make sure permissions are correct (usually 755 for folders, 644 for files).

Verifying Success of the Database Restoration

  • Visit your website URL and check if the site loads with restored content.
  • Access your WordPress admin dashboard and verify posts, pages, and settings.
  • Confirm plugin and theme functionality to rule out file-related issues.
  • Look for any database connection errors or warnings and check error logs if available.

Common Mistakes and How to Avoid Them

  • Not Backing Up Current Data: Always have a current backup before restoration to revert if necessary.
  • Failing to Clear Existing Database Content: Import errors can occur if tables already exist with conflicting data.
  • Incorrect Database Credentials: Verify wp-config.php contains correct DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST entries.
  • Using an Incompatible Backup File: Confirm the backup matches your WordPress version and database type.
  • Ignoring File Permissions on FTP: Wrong permissions can cause errors in loading or plugin failures.
  • Overlooking Site Downtime: Let users know about downtime to prevent confusion.

Useful Alternatives to Manual Restoration

  • Command-Line Tools: Use WP-CLI for database operations if SSH is available: wp db import backup.sql.
  • Use Hosting Backup Systems: Some hosts provide automated backup and restore options in control panels.
  • Restore with Backup Plugins: Although excluded here, plugins like UpdraftPlus automate database and file restoration.
  • Consult Hosting Support: Hosting providers often help restore databases on request.

Short FAQ

BSoD in Windows Server version 2004 (server core) till Windows Server 2022.png
Image: Wikimedia Commons · Microsoft · Public domain
QuestionAnswer
Can I restore the WordPress database without access to phpMyAdmin?Yes, if you have SSH access, you can use MySQL command-line tools to import the backup.
What file format is required for manual database restoration?Typically, .sql files are used; compressed formats like .zip or .gzip may also work if supported by your tool.
Will manual restoration affect my site URLs or settings?No, the database contains your URLs and settings; restoring it will return these to the backup state.
Do I need to restore WordPress core files along with the database?Only if corrupted or missing; often restoring the database alone is sufficient.
How to fix “Error establishing a database connection” after restoration?Check wp-config.php credentials, confirm database is imported correctly, and ensure the database server is running.

Screenshot Suggestions

  • phpMyAdmin Import tab showing the selection of SQL backup file for import.
  • FTP client interface uploading wp-content folder to the server.
  • phpMyAdmin database tables list with all tables selected and dropped before import.
  • WordPress admin dashboard homepage showing successful restoration.

Troubleshooting Common Issues During Manual WordPress Database Restoration

Manual restoration may encounter hiccups due to various reasons. Here are some typical problems and how to handle them:

  • Import Failure Due to Large File Size:
    • PhpMyAdmin often limits file upload size (e.g., 2MB or 8MB). If your backup is larger, you can:
      • Split the SQL file into smaller parts and import sequentially.
      • Use command-line import via SSH, which bypasses upload limits.
      • Increase PHP max upload size in php.ini or via hosting control panel.
  • Syntax Errors During Import:
    • If you see errors mentioning syntax, the backup file may be corrupted or incomplete. Ensure your export was successful and the file is intact.
    • Use a plain text editor to view the SQL file start and confirm it begins with standard SQL syntax clauses.
  • Database Connection Errors After Restoration:
    • Verify wp-config.php contains the correct database host, username, password, and database name.
    • Check if the database user has sufficient privileges.
    • Ensure the database server is running and accessible.
  • Missing Content or Incomplete Site:
    • Double-check that the correct database was restored.
    • Ensure the import completed fully without interruption.
    • Confirm the wp_options table entries like siteurl and home match your site’s current URL.
  • Incorrect File Permissions Leading to Errors:
    • WordPress needs correct permissions: folders usually 755, files 644.
    • Set permissions recursively if needed using FTP clients or SSH commands:
    • find /path_to_wordpress/ -type d -exec chmod 755 {} \;
      find /path_to_wordpress/ -type f -exec chmod 644 {} \;

Post-Restoration Optimization and Security Checks

After a successful manual restoration, it’s vital to optimize your site and secure it to prevent future issues:

  • Check and Update Permalinks:

    Log into WordPress dashboard → Settings → Permalinks and re-save your permalink settings. This flushes .htaccess rules and prevents 404 errors.

  • Run Database Optimization:

    Use phpMyAdmin or WP-CLI to optimize tables and clean overhead:

    OPTIMIZE TABLE wp_options; OPTIMIZE TABLE wp_posts; etc.
  • Review User Accounts:

    Confirm that administrator accounts are intact and no unauthorized users were introduced during restoration.

  • Change Security Keys:

    Consider refreshing security keys in wp-config.php to invalidate user sessions if the backup is old or compromised.

  • Backup Immediately:

    Take a fresh backup after restoration to ensure you have an updated recovery point.

  • Update WordPress and Plugins:

    Ensure WordPress core, themes, and plugins are updated to the latest secure versions.

Additional Tips for Large or Complex Sites

When restoring sites with substantial volume or complexity, consider these advanced approaches:

  • Use SSH and WP-CLI Tools:

    Command-line tools handle large files more efficiently and allow automation:

    wp db import /path/to/backup.sql
    wp cache flush
    wp plugin status
  • Split Database Into Sections:

    For very large databases, export and import individual tables or groups to sidestep timeout or memory issues.

  • Utilize Staging Environments:

    Test restoration on a duplicate staging site before applying to production to minimize downtime risks.

  • Maintain Consistent URL Structures:

    If the domain or site URL changes, use search and replace tools for database entries after restoration to avoid broken links.

  • Monitor Server Logs:

    Watch your web server and database logs post-restoration to spot errors and fix them immediately.

FAQ: Deep Dive into Manual WordPress Database Restoration

QuestionDetailed Answer
What is the difference between “Empty” and “Drop” tables before import?“Empty” removes all data from tables but keeps the table structure. “Drop” deletes the entire table including structure. For restoring a full backup, “Drop” ensures no leftover structure conflicts, but make sure your backup SQL file recreates tables.
Can I restore only selective tables instead of the full WordPress database?Yes, if you only want to restore parts (e.g., posts table), export/import those specific tables. However, restoring only part of the database can lead to inconsistencies if related data is missing.
How do I handle serialized data changes if migrating URLs?WordPress stores some data serialized, so manual search-and-replace in raw SQL can break it. Use WP-CLI’s search-replace command or specialized plugins that safely update serialized entries.
Why does import fail with max execution time or memory errors?Your web server or PHP settings limit script execution time and memory usage. Ask your host to increase max_execution_time, memory_limit, or use CLI-based import that aren’t constrained by PHP limits.
Is there a risk of data loss when restoring manually?Yes, if you overwrite a live database without backups. Always keep recent backups before restoring, restore during low-traffic hours, and verify success before resuming normal operations.
Can I restore a backup created from a different WordPress version?Usually yes, but some database schema differences might cause errors or missing features. It’s best to backup and restore with the same major WordPress version or test first.
What to do if the site displays database connection errors after restoration?Double-check wp-config.php settings, confirm the database is imported, make sure the database user has proper permissions, and verify that your MySQL service is running.

Leave a Comment

Scroll to Top