Can't access any databases anymore (ERR_UNSAFE_PORT)

Issue Summary

Trying to open Adminer I get a ERR_UNSAFE_PORT error. None of my sites are able to open adminer or access any databases.

Using Site Shell and for instance a command like wp db reset gives me this error: Error: Failed to get current SQL modes. Reason: ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)

System Details

  • Which version of Local is being used?
    6.1.8+5621

  • What Operating System (OS) and OS version is being used?
    macOS Monterey

  • Attach the Local Log. See this Community Forum post for instructions on how to do so:
    local-lightning.log (253.3 KB)

ERR_UNSAFE_PORT is definitely an odd error! What port is Local opening?

I know that WPCLI needs an update in order for some of these things to work. I think that it’s been fixed, since this bug report I opened has been closed, but I don’t think the code has been merged into a stable release of WPCLI:

1 Like

It’s opening on port 10080: http://localhost:10080/?username=root&db=local

Ahh crap! Yep, that’s a bug that we’re just finishing up this sprint and should be released in the next version of Local.

Basically, there’s a security risk of using port 10080 and because of that, Chrome blocks that port:

As a workaround for today before the release of the new version of Local, I think you should be able to export the site by right-clicking on it in Local and then import the zip to create a new site that uses a new port.

Hi Ben!

When will this new version be out? :slight_smile:

I have 16 sites as of now, and all of them opens on that port. Do I need to clone each one?
Also, I find it weird that this will fix them as all of them have this issue…?

We don’t have a specific ETA for when the release will come, but soon!

I don’t think you’ll need to clone each one, but you should try exporting and importing the first one to see how it goes!

Is there a way for me to avoid exporting / importing? Could I instead change some configurations, etc.?

Maybe!

Try these steps:

  1. Backup all sites, because you know, when monkeying around with configs, things happen!
  2. Stop Local
  3. Navigate to Local’s configuration folder at ~/Library/Application Support/local and back up the sites.json file.
  4. Open the sites.json file and update the site that’s using that unsafe port – 10080. I think you should be able to use any unused port.
  5. Start Local and start the site that was using that port.

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