Are these the correct steps to use Adminer to restore a local.sql backup?

What issue or error are you experiencing?

This issue is restoring a local.sql file from two days ago to replace the one that may be corrupted.

What steps can be taken to replicate the issue? Feel free to include screenshots, videos, etc

Hoping this is the right place to post; I am requesting support team, maybe Clay, to verify these steps. As of this writing, I have not tried this myself, but this is the result of my research. Please make corrections and let me know. I need to restore my database from a previous backup!!!

How to use Adminer to Restore a local.sql database from a previous local.sql database backup. Is this correct?

  1. Backup the site using another backup software, for example Backu4All (whole computer and selective directories backup) or updraftplus (which allows saving database backup offline).
    (A local.sql backup can also be created by exporting the current database to another directory via Adminer as followes: With the site started, open Adminer. Click Export. Output: save, Format SQL. Click the smaller Export button.)

  2. Stop the Site: Check that a new local.sql file was created when the site stopped in the local backup directory: …\Local Sites\devDirectory\app\sql

  3. Copy and paste the existing local.sql database (even if its corrupt) to another directory somewhere for safe keeping.

  4. Copy a selected previous backup to …\Local Sites\devDirectory\app\sql
    – Select the desired previous version of local.sql file.
    – Navigate to the local sites backup directory …\Local Sites\devDirectory\app\sql
    – Double-check that a copy of the current local.sql file was made; THE NEXT STEP WILL OVERWRITE THE CURRENT LOCAL.SQL FILE.
    – Paste the selected local.sql backup file to …\Local Sites\devDirectory\app\sql

  5. From Adminer, Import the just pasted SQL File.
    – Restart the site in Local.
    – Open Adminer.
    – Click the Import button, click Browse to navigate to the …\Local Sites\devDirectory\app\sql directory
    – Select the newly pasted local.sql file.
    – Click Execute. This will replace the existing database contents with the data from the backup.

  6. Verify the Import:
    – After importing, check the WordPress site to ensure that the database has been restored correctly.
    – Verify that the posts, pages, and other data match the state from expected from the backup.

  7. Troubleshooting:
    – If the changes do not reflect immediately, clear the browser cache or use a different browser to check the site.
    – Ensure that there are no errors during the import process in Adminer.
    – If the data isn’t as expected, restore a differenct local.sql backup
    – In the worst case, restore from you updraftplus backup.


System Details

  • Local Version:
    9.02+6676
  • Operating System (OS) and OS version:
    Windows 10

Local Logs

Attach your Local Logs here (Help Doc - Retrieving Local’s Log)


Security Reminder
Local does a pretty good job of scrubbing private info from the logs and the errors it produces, however there’s always the possibility that something private can come through. Because these are public forums, always review the screenshots you are sharing to make sure there isn’t private info like passwords being displayed.

Update. I posted the above 35 minutes ago.
After making 4 distinct backups of the current database, I followed the steps which I outlined above.
It worked!!
I had made changes to an ACF field which for some reason did not take; code errored using the new field name, but worked great using the old field name which I definitely changed and checked and rechecked several times. This led me to believe it is a BAD idea to ever CHANGE an ACF field name!

After restoring, I verified that changes made to a test post were definitely rolled back. The database I have now is the database I had from three days ago.

Nevertheless, I would still appreciate any corrections or recommendations from real support as to the validity and completeness of the above steps just outlined.

Thank you!!!

1 Like

Hi @bobby! Thank you for sharing your process here and we’re glad you were able to get things going.

Your steps look good here but I’ll share that we do have a blurb on our help doc below with some manual workaround steps for importing a database into Local that some users might like:

You can also use a free plugin like WP Migrate Lite to export a site or a database as well.

If you have any other questions or concerns don’t hesitate to reach back out. We are always happy to help!

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.