PHP memory limit error when importing / Failed to get current SQL modes. Reason: ERROR 2003 (HY000)

So I need to import a sqldump.sql or better said update the existing one. I went the route suggested here
because I get a fatal error in Adminer (the db is just 140mb in size…)

Fatal error : Allowed memory size of 268435456 bytes exhausted (tried to allocate 150604992 bytes) inC:\Program Files (x86)\LocalWp\resources\extraResources\adminer\adminer.php on line98

So I did the following:

  1. Copy the sql file to the site root. That location should be something like: ~/Local Sites/sitename/app/public/
  2. Right-click on the site in Local and select “Open site shell”
  3. Within the terminal that opens, import the sql file using this command:
wp db import name-of-sql-file.sql

And I’m getting this what ever I do:

Error: Failed to get current SQL modes. Reason: ERROR 2003 (HY000): Can’t connect to MySQL server on ‘localhost’ (10061)

What I’m doing wrong?

Hi @Mike8040

We would be happy to assist with your Local troubleshooting! Could you provide some more details to help us take a further look?

  • What is your OS?

  • What version of Local are you on?

  • Please attach a copy of your Local Logs

Keep us posted and we’d be happy to help further!

I’m having the same exact problem. Same exact process and same exact error.

OS: Windows 10
Local version: 8.1.0+6514

Are you able to manually import the DB using steps like what Ben mentioned here?

That documentation contains the same process that the original poster and I both used which produced the error.

I am just trying to import the database into the site where I have cloned my code base repository. I don’t need to import wp-content, just the database. Please help.

Here is a related Stackoverflow thread for Windows users experiencing the same error that seems to have some solutions shared:

Hi Nick,

This doesn’t really help. We’re following the exact steps you folks recommend in your documentation and it’s not working. Can your team help us understand how we can get past this error? We can’t be the only folks that have faced this error.

I’m getting a similar error while doing this request at Adminer Memory Exhausted - Windows 11.

System Details

  • Local Version:
    Version 8.1.0+6514
  • Operating System (OS) and OS version:
    Windows 11 Pro

I understand @tnaughton , however, the error is fairly generic so it’s tough to pinpoint. It could be related to something specific in your machine/OS and not necessarily a setting within the Local app. As noted in the link I shared there could be a handful or several different reasons for it.

In order for us to take a deeper look could you share your Local Log? For us to be able to troubleshoot thoroughly, please click the Download Local Logs button from the Support tab in Local. This will generate a zip archive that contains the Local log along with some other diagnostic information to help quickly zero in on any issues that Local is encountering.

Continuing the discussion from Adminer memory exhausted:

I’m getting this error on a blank WordPress install.

What issue or error are you experiencing?

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 130023456 bytes) in C:\Users..\AppData\Local\Programs\Local\resources\extraResources\adminer\adminer.php on line 98


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

Importing 26.7 MB sql.gz database created by WP Migrate Lite


System Details

  • Local Version:
    Version 8.1.0+6514

  • Operating System (OS) and OS version:
    Windows 11 Pro


Local Logs

local-logs.zip (79.3 KB)


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.

No - I’m getting the following error.

Site is started in Local & operating as expected.

Database created by WP Migrate Lite added at App>Public

Hi @buzztone - I merged your thread in here just to keep all troubleshooting and comms in the same place.

As mentioned, there could be different culprits potentially for this same error.

With Windows it’s always a good idea to just perms and privileges:

There is also a workaround mentioned Ben here that might work as well:

@Mike8040 or @tnaughton If you’re still having issues please share your Local Logs and we can try and take a further look.

I tried this workaround & was able to import the 486 MB sql database file created by WP Migrate Lite.

Found Local Database Port

Edited Local wp-config.php for this site

Imported Database with wp db import your-database-filename.sql

1 Like

Thank you for the followup @buzztone!

@Mike8040 and @tnaughton that might be a good workflow to try next if you’re still having issues!

I’m glad of the assistance in solving my current problem but surely this is a bug.

When using wp db import your-database-filename.sql from the Local Site Shell the Local Database port is not correctly identified.

Importing an existing website database is documented at Import/Export a WordPress Site - Manually Import a Local site. But this clearly often does not work on Windows computers.

Local Shell uses port 10061

Local Database port is different

Fixed by following Workaround

This can be fixed by following this Workaround where the actual Local Database port is added in the Local site’s wp-config.php file.

If the Local Site Shell was able to correctly identify the Local Database port on Windows computers, this particular problem would be eliminated for Windows users.

Hi @buzztone - You are correct. I checked and we do have a bug filed going back to this comment from Ben that I shared earlier. I’ll send a note to the dev team that you and others have been coming across this again.

@Nick-B sorry for showing my frustration. I appreciate your team getting back to us. I followed the steps from buzztone and was able to load one one my sites. Thanks again.

1 Like

Glad to hear it @tnaughton! Thank you for the follow up here. @Mike8040 let us know if you still have any issues or if that workaround fixes things up on your end as well.