SQL missing table error prevent importing site

The error “Uploading .zip file to local Lightning results in a missing local.wp_options table:”

Upon trying to upload a customer's .zip file - we had the same error you are reporting:
    Error: Command failed: /Applications/Local.app/Contents/Resources/extraResources/lightning-services/mysql-8.0.16+3/bin/darwin/bin/mysql local -B --disable-column-names -e SELECT option_value FROM wp_options WHERE option_name = 'siteurl';
    ERROR 1146 (42S02) at line 1: Table 'local.wp_options' doesn't exist

We worked with a customer who had reported the same error when importing a site into Local Lightning and when I then tried installing it on local 3.2.0 and it appears to have worked.

Testing:

When starting the site from Local 3.2.0 you see the empty database screen to select a language but there is no database tables in the local database (empty) - when I look at the .SQL file (attached) it shows there are tables.

I tried to import the database manually within adminer but it produced an error:

## -- Table structure for table  `wp_commentmeta`

CREATE TABLE  `wp_commentmeta`  (
`meta_id`  bigint(20) UNSIGNED NOT NULL,
`comment_id`  bigint(20) UNSIGNED NOT NULL DEFAULT '0',
`meta_key`  varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`meta_value`  longtext COLLATE utf8mb4_unicode_ci
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
Error in query (1050): Table 'wp_commentmeta' already exists

I realized the database is actually present just in the wrong location and explains the initial error

The issue:

The issue is that the site’s database is actually located inside the wrong database somehow. I moved the tables to the local database and the site appears magically.

You will need to move the database from it’s d_baginc_wp database into the local database. You can do that by following these steps:

Solution:

In Local by Flywheel 3.3.0 (Local by Flywheel 3.3.0 download link) you can import that .zip backup by dragging and dropping the file. Then head to the database tab after the site spins up.
Select the Adminer button which should open a browser window that will look like this:
https://i.getf.ly/WnuGzddD
Select the Server tab at the top
https://i.getf.ly/5zu1W77Q
Then select all tables and move them to the “local database” like this:
https://i.getf.ly/Kouqzyey
From there just select move and the site should now load.

1 Like