Trying to add site but it self deletes after opening SQL Database

During the install from zip process the site self-deletes after trying to open the MySQL database.

I am just trying to backup a website for a friend, and wanted to give them the option of using a program like Local to view their full site so they can easily and visually see it is all there.

I have access to their ftp as well as the SQL database, but their host (Namesco) sold Wordpress access and CP access as add ons, so they are not available to me. I have attempted to use MySQL (via mybadadmin.co.uk) to export the sql, and then download the site with Filezilla. However, when attempting to install it gets to the sql database and then self-deletes everything (as a bit of feedback - an error message would be nice!). I have attempted to match the import settings as closely as possible to the settings on MySql but to no avail.
I also followed another post here an attempted the same thing with only the SQL database and the wp-content folder in the zip file, but this also failed at the same point.

Any other ideas/pointers?


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


System Details

  • Local Version:

  • Operating System (OS) and OS version:


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.

Hi @DYEvans

You could attempt a more manual import. The steps would look like this:

  • Unzip the file in a common location, like the desktop
  • Create a new, blank site in Local. Use whatever username/password you like since you’ll overwrite the DB with this site archive’s dump.
  • Copy the wp-content folder from the unzipped location to this newly created site’s location
  • Copy the correct SQL dump to the site root.
  • Within Local, open the site shell
  • Import the dump with wp db import <dumpfile>
  • If that works, now Search and replace the domains. wp search-replace ' https://production.com ' 'http:mylocalsite.local'

Thanks for the very speedy reply I’m with you up until the last point (it all worked to that point) - is ‘production.com’ what I should actually be replacing? or should I be replacing the actual original domain with this?

I tried a few variations of this command but nothing resulted in any replacements.

Production would be whatever the original domain of the site was and then you’re be replacing it with the Local domain!

Hi, so I actually made a little progress… it turned out I had the wrong database - there were two on the nameco site. Using the correct one the install hangs for longer on the SQL database stage, but then throws an incompatible zip error and fails out.

The in the router logs the only error that shows up is:
3/07/25 16:55:21 [emerg] 8601#0: bind() to [::]:80 failed (48: Address already in use)
2023/07/25 16:55:21 [emerg] 8601#0: bind() to 0.0.0.0:443 failed (48: Address already in use)

I have also copied in the errors from the lighting log:

{"thread":"main","class":"ImporterGeneric","code":1,"killed":false,"signal":null,"cmd":"%%resourcesPath%%/lightning-services/mysql-8.0.16+6/bin/darwin/bin/mysql local -B --disable-column-names -e SELECT option_value FROM wp_options WHERE option_name = 'siteurl';","level":"error","stack":"Error: Command failed: %%resourcesPath%%/lightning-services/mysql-8.0.16+6/bin/darwin/bin/mysql local -B --disable-column-names -e SELECT option_value FROM wp_options WHERE option_name = 'siteurl';\nERROR 1146 (42S02) at line 1: Table 'local.wp_options' doesn't exist\n\n    at ChildProcess.exithandler (node:child_process:407:12)\n    at ChildProcess.emit (node:events:527:28)\n    at maybeClose (node:internal/child_process:1092:16)\n    at Socket.<anonymous> (node:internal/child_process:451:11)\n    at Socket.emit (node:events:527:28)\n    at Pipe.<anonymous> (node:net:709:12)","message":"Command failed: %%resourcesPath%%/lightning-services/mysql-8.0.16+6/bin/darwin/bin/mysql local -B --disable-column-names -e SELECT option_value FROM wp_options WHERE option_name = 'siteurl';\nERROR 1146 (42S02) at line 1: Table 'local.wp_options' doesn't exist\n","timestamp":"2023-07-25T15:55:57.102Z"}
{"stack":"Error: Command failed: %%resourcesPath%%/lightning-services/mysql-8.0.16+6/bin/darwin/bin/mysql local -B --disable-column-names -e SELECT option_value FROM wp_options WHERE option_name = 'siteurl';\nERROR 1146 (42S02) at line 1: Table 'local.wp_options' doesn't exist\n\n    at ChildProcess.exithandler (node:child_process:407:12)\n    at ChildProcess.emit (node:events:527:28)\n    at maybeClose (node:internal/child_process:1092:16)\n    at Socket.<anonymous> (node:internal/child_process:451:11)\n    at Socket.emit (node:events:527:28)\n    at Pipe.<anonymous> (node:net:709:12)","level":"warn","message":"Unable to import site.","timestamp":"2023-07-25T15:55:57.120Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2023-07-25T15:59:32.582735Z 0 [System] [MY-010116] [Server] %%resourcesPath%%/lightning-services/mysql-8.0.16+6/bin/darwin/bin/mysqld (mysqld 8.0.16) starting as process 9223","timestamp":"2023-07-25T15:59:33.109Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2023-07-25T15:59:32.585087Z 0 [Warning] [MY-013243] [Server] --character-set-server: The character set UTF8MB3 is deprecated and will be removed in a future release. Please consider using UTF8MB4 instead.","timestamp":"2023-07-25T15:59:33.109Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2023-07-25T15:59:32.586550Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for %%site.runData%%/mysql/data/ is case insensitive","timestamp":"2023-07-25T15:59:33.110Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2023-07-25T15:59:33.077739Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.","timestamp":"2023-07-25T15:59:33.110Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2023-07-25T15:59:33.108952Z 0 [System] [MY-010931] [Server] %%resourcesPath%%/lightning-services/mysql-8.0.16+6/bin/darwin/bin/mysqld: ready for connections. Version: '8.0.16'  socket: '%%site.runData%%/mysql/mysqld.sock'  port: 10011  MySQL Community Server - GPL.","timestamp":"2023-07-25T15:59:33.111Z"}
{"thread":"main","class":"ImporterGeneric","code":1,"killed":false,"signal":null,"cmd":"%%resourcesPath%%/lightning-services/mysql-8.0.16+6/bin/darwin/bin/mysql local -B --disable-column-names -e SELECT option_value FROM wp_options WHERE option_name = 'siteurl';","level":"error","stack":"Error: Command failed: %%resourcesPath%%/lightning-services/mysql-8.0.16+6/bin/darwin/bin/mysql local -B --disable-column-names -e SELECT option_value FROM wp_options WHERE option_name = 'siteurl';\nERROR 1146 (42S02) at line 1: Table 'local.wp_options' doesn't exist\n\n    at ChildProcess.exithandler (node:child_process:407:12)\n    at ChildProcess.emit (node:events:527:28)\n    at maybeClose (node:internal/child_process:1092:16)\n    at Socket.<anonymous> (node:internal/child_process:451:11)\n    at Socket.emit (node:events:527:28)\n    at Pipe.<anonymous> (node:net:709:12)","message":"Command failed: %%resourcesPath%%/lightning-services/mysql-8.0.16+6/bin/darwin/bin/mysql local -B --disable-column-names -e SELECT option_value FROM wp_options WHERE option_name = 'siteurl';\nERROR 1146 (42S02) at line 1: Table 'local.wp_options' doesn't exist\n","timestamp":"2023-07-25T16:00:14.625Z"}
{"stack":"Error: Command failed: %%resourcesPath%%/lightning-services/mysql-8.0.16+6/bin/darwin/bin/mysql local -B --disable-column-names -e SELECT option_value FROM wp_options WHERE option_name = 'siteurl';\nERROR 1146 (42S02) at line 1: Table 'local.wp_options' doesn't exist\n\n    at ChildProcess.exithandler (node:child_process:407:12)\n    at ChildProcess.emit (node:events:527:28)\n    at maybeClose (node:internal/child_process:1092:16)\n    at Socket.<anonymous> (node:internal/child_process:451:11)\n    at Socket.emit (node:events:527:28)\n    at Pipe.<anonymous> (node:net:709:12)","level":"warn","message":"Unable to import site.","timestamp":"2023-07-25T16:00:14.643Z"}

Based on the logs it looks like there might be a port conflict occurring. Here are some steps to help identify and address this:

  • Stop all sites that are running in Local

  • Force quit Local

  • (If using Mac) Run the command lsof -nP -iTCP -sTCP:LISTEN

  • (If using Windows) Run the command netstat -ano

What you’ll be looking for here is to see when sites are stopped and Local is properly shut down if there are still programs running on ports 80 and 443. These may be conflicting with Local or the system may be reporting Local is still running.

Once you run that command you should see a list of listening ports. If you see a particular program making use of those ports, you can then kill that process by running sudo kill -9 XXX where XXX is the PID number of that process. (On Windows you will use taskkill /F /pid XXX where XXX is the PID number of that process)

There are also some more details around this and other troubleshooting steps at this link if needed: Stopping Whatever Is Listening On Port 80.

That doesn’t seem to be it, there is nothing listening on those ports. I shut down all of the listening services (apart from apples internal ones) for good measure, but it has the same result in the router log file.

Compared to where the site was built/hosted are the WP/PHP/MYSQL versions all lined up when importing?

Additionally, can you share these details and your full log?

  • What is your OS?

  • What version of Local are you on?

  • Please attach a copy of your Local Logs

No, I did try a manual import but the the ‘correct’ versions were not available in the options. From the database file:

MySQL: 7.4.33
PHP: 7.4.33 (weird that these are identical?)
WP: 4.3.1.5

OSX 12.6.3
Local 7.1.0-6396
local-logs3.zip (8.7 KB)

As another note:
I tried the manual setup again and when running the search/replace it still comes back with 0 entries replaced. I have confirmed the exact address is in the database file and try to replace with ‘http://judytest.local’ but nothing gets replaced.

Also tried ‘http:judytest.local’

I made a little more progress.

I noticed that in the manual site creation the database was directing to the database called ‘local’ - not the database I transferred over. So I therefore opened the databases in Adminer, renamed the local database to something else and then named the imported one “local”. This allowed me to run the find and replace command.

Now when opening the site I get all of the text content. The formatting/theme has not worked. But at least the site has loaded!

Any pointers on what to do, I did copy in the rest of the size from the unzipped files but that wont load if I do that.

Any pointers on how to get the site to load normally? Or are you still missing some other piece?

As far as the theme/styling of the site it may be broken unfortunately because the original site’s WordPress version was so out of date. There may be incompatibilities with certain plugins, the theme, or other site-level development.

Thanks, yes that’s what I was asking,

I actually replaced the whole folder that had been made by Local with the content from my download, only keeping wp-config.php in place, but I got the same result.

What would the outdated wordpress/plugins be conflicting with to prevent the style working? The way I thought it would work is that it would mirror what the website looked like at the time, as all of the plugins and wordpress version are contained in the site folder. Is there a conflict with some parts of Local app itself?

Local doesn’t include all the older WordPress versions and the themes and plugins on that site likely aren’t compatible with newer versions. In your Local app when you’re looking at the site UI what does the WordPress version say? Probably 6.2.2

This comes up from time to time and users find ways to get older versions working. One of our users mentions this plugin works well:

What the user in that thread you linked did is essentially exactly what I have done.

Just to be clear - after installing the new site on the Local App I deleted everything from it’s directory apart from the wp-config file and I then dragged all of the old files from my downloaded site into this directory.

So in effect I did manually roll back Wordpress by doing this.

The version Local shows is 4.3.15

I think I have figured out why it’s happening but dont need know how to solve.

If I spin up another site in local and look where it is pointing to for the style sheet I see this:
http://testest.local/wp-content/themes/twentytwentyone/style.css?ver=1.8

But if I copy the one from my site it looks like this:
http://judyben.local/judyben.local/wp-content/themes/dynamic-dream/style.css

As you can see the first part of the address is duplicated, and this is whats causing the error. But I am unsure what part of the wordpress directory/site defines this address?

So I know the problem lies somewhere in the wp_content section of the database.

If I copy a wp_content section over from a blank site with the same theme the redirects to the style.css etc all work and the theme displays correctly. But this obviously breaks a lot of other things on the site.

If anyone has any ideas what needs adjusting in wp_content to stop the links duplicating the site I would love to know! :slight_smile:

Ahhhh just figured it out… I hadn’t added “http://” in front of the site url… which must have triggered some rule to add it in duplicating the address.

Anyway. It’s finally all figured out and working!

Thank you for following up and sharing your solution! Happy Developing :green_heart:

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