Help! Accidentally ran find & replace on local database


I was trying to export my local site from local by flywheel to a staging site using WP Migrate DB.

I seem to have replaced the local address with the staging address, but didn’t hit export. Local site has crashed and can’t even import the latest backup into local by flywheel.

When I try to log in the “admin” button goes to this URL: http://clb3x3.local/clb3x3.local/wp-login.php

clb3x3.local is repeated.

How can I reverse this through Adminer? Or am I doomed to start the site again.

If anyone has had this happen before please let me know if it can be undone!


1 Like

When I migrate a site, I always change the url as described below. It should also work in your case.

In the left pane of Adminer click on ‘Export’ and then in the right pane select under ‘Output’ --> save
Click on the ‘Export’ button in the right pane.

You now have a ‘local.sql’ file.
Just for security, copy this file and give it another name (e.g. simply ‘local-copy.sql’, so that you always have the originally downloaded file).

Now open your downloaded file in a simple text editor like Notepad or Notepad++
Do a ‘search’ and ‘replace’ like this:
Find: http://clb3x3.local/clb3x3.local/
Replace with: http://clb3x3.local/
And make sure you select ‘Replace all’
Save the file as e.g. ‘local-edited.sql’

Go back to Adminer, select all tables and click ‘Drop’ (meaning all will be deleted). Don’t worry, as you still have the originally downloaded sql file. But that’s not the one you’re going to use: in the left pane click on ‘Import’, choose your ‘local-edited.sql’ file and click on ‘Execute’.
All tables with the edited url will be imported and if you did everything right, you should be able to access your site again.

Hope this helps.