Local Community

How can I update the database for a non-linked site?

I have a site in Local that was manually created from a backup (not linked). I have a new backup of the sql from the live site that I’d like to update my local version to use. Placing it into the sql folder didn’t do anything. Is there a way to re-import the new sql file only to the existing site?

Answering my own question here for anyone who might be wondering:

In Local, Start the site and go to the DATABASE tab, then click OPEN ADMINER. In Adminer you can Import the new sql file into the current non-linked project.

One more followup step that is necessary for importing a sql file in ADMINER is to then perform the following query/command to update the links in all the posts:

UPDATE wp_options SET option_value = replace(option_value, 'https://production.url', 'http://local.url') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'https://production.url','http://local.url');
UPDATE wp_posts SET post_content = replace(post_content, 'https://production.url', 'http://local.url');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'https://production.url','http://local.url');

You’ll need to replace https://production.url with your sites real url and http://local.url with the local url that Local app provides for your site. Be sure to use http for your local version if it is not https.