Local Community

Error exporting database on stopping site

When I stop one of the two sites that I have active, I get this error message:
Error: mysqldump exited with non-zero exit code. at exports.default. …(C:\Users…\AppData\Local\Programs\Local\resources\app.asar\main\sites\database\Sit…'1740) at Generator.next().

I am using separate databases for the each of the two sites and both have the names as defined in their respective wp-config.php files.

Hey @seth, Welcome to the Local Community Forums!

It’s hard to know exactly what’s happening from just the error message. Can you please provide your Local Log so we can see what other things are going on within Local? See this Community Forum post for instructions on how to do so:

Thanks so much Ben!
I don’t think the log is being created. I found a folder called C:\Users\DefaultAppPool\AppData\Roaming

but it only contains a folder within call “microsoft”. When I tried navigating to that folder I had to tell Windows that I wanted to continue as an administrator. Perhaps that is related. I will look for posts on log files not being created and post my log file once I am able to create one.

@ben.turner I found it now (see attached). Sorry I missed some of the instructions in the link you sentlocal-lightning.log (319.3 KB)

I’m seeing that same error within the logs:

{"thread":"main","class":"","stack":"Error: mysqldump exited with non-zero exit code.\n    at exports.default.<anonymous> (%%appPath%%\\main\\sites\\database\\SiteDatabaseService.js:1:1740)\n    at Generator.next (<anonymous>)\n    at o (%%appPath%%\\main\\sites\\database\\SiteDatabaseService.js:1:124)\n    at processTicksAndRejections (internal/process/task_queues.js:85:5)","level":"error","message":"Unable to dump database.","timestamp":"2020-09-24T01:01:47.731Z"}

There’s also an entry mentioning that Local can’t update the hosts file:

{"thread":"main","class":"HostsFileService","error":{},"stdout":{},"stderr":{},"exitCode":{},"level":"error","message":"Could not update hosts.","timestamp":"2020-09-22T16:27:33.053Z"}
  • Are you able to create new, plain WordPress sites?
  • For these sites that aren’t able to be exported, are you able to reach them within the browser?
  • If you have any antivirus software or something that might a “Windows Cleaner” app, can you try disabling it and re-try exporting the sites as well as creating new ones?

@ben.turner
Thanks for your response.

  1. I am able to make create new WordPress sites. The site that is giving my problems was created with Apache on a local server using XAMPP. I am attempting to convert to NGINX and imported it into Flywheel to do the conversion.
  2. I am able to view all sites within the browser including this one. The only problem seems to be with the automatic saving of the database when I close it. Is that the only time the Database gets saved with using Flywheel or is it an extra backup step when exiting. Maybe it is a problem I can just live with and manually backup the database.
  3. I am not using any antivirus software.

The raw database files live within Local’s configuration folder within a run folder, but the DB is exported to a SQL file when a site is stopped as a sort of backup step. This is because a SQL file is easier to restore than the raw DB files in the event that something becomes corrupted.

I wonder if this issue will go away once the site has been converted to NGINX?

When you imported the site, how did you do that? You might try importing the site directly into an NGINX site by using the files for the site. The process is pretty easy and is outined by following the steps in the “Restoring From Only Local Site files” section of this help doc:

@ben.turner
Thanks for the details about the database being stored in the run folder. That explains why the site is working even though the database automatic saving is failing when I close it.

I converted the site from Apache when I first started using it with Flywheel using the method documented in the link you referenced. At this point I am thinking that I should just live with that error and manually backup with database using adminer or phpmyadmin. Is there an advantage of one of these over the other?

I haven’t used the two (Adminer vs PHPMyAdmin) in a way that I would notice a huge difference. I think that they would both provide a usable sql file that you can use as a backup of the site’s DB.

These days, I would go with Adminer because it’s shipped with Local, but if you want to install phpMyAdmin, I don’t see why it wouldn’t work!

Thanks! I attempted to use configure PHPMyAdmin on a Raspberry Pi which I am using as the Web Server. It offers Apache but not NGINX. Since I am running NGINX, I will attempt use Adminer.

I tried to make a backup of the site from Flywheel but it had issues as well which I think may be related. I was able to successfully clone the site within Flywheel, but the cloned site also would not close properly. At this point it seems like I am best off moving all files manually to the web-server.