Unable to Start Site 'Can't connect to local MySQL server through socket'

What issue or error are you experiencing?

Uh-oh unable to start site popup, full error:
Error: Command failed: /Users//Library/Application Support/Local/lightning-services/mysql-8.0.16+6/bin/darwin/bin/mysqladmin ping
amysqladmin: connect to server at ‘localhost’ failed
error: 'Can’t connect to local MySQL server through socket '/Users/
/Library/Application Support/Local/run/vC_agctSF/mysql/mysqld.sock’ (61)’
Check that mysqld is running and that the socket: ‘/Users/***/Library/Application Support/Local/run/vC_agctSF/mysql/mysqld.sock’ exists!

at ChildProcess.exithandler (node:child_process:430:12)
at ChildProcess.emit (node:events:513:28)
at ChildProcess.emit (node:domain:489:12)
at maybeClose (node:internal/child_process:1091:16)
at Socket. (node:internal/child_process:449:11)
at Socket.emit (node:events:513:28)
at Socket.emit (node:domain:489:12)
at Pipe. (node:net:322:12)


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

open program, try to start one of my sites, works fine on others


System Details

  • Local Version:
    Version 8.2.1+6583

  • Operating System (OS) and OS version:
    macOS 14.3 (23D56)


Local Logs

Attach your Local Logs here (Help Doc - Retrieving Local’s Log)
local-logs2.zip (1.3 MB)


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 @ZolaDesigners

If you change your Router Mode to Localhost are you able to proceed? Preferences>Advanced>Router Mode>Localhost

Hi, I literally have this exact same issue and need some help. I just installed Local on my MAC with OS High Sierra 10.13.6. That is the latest version I can use.

Error: Command failed: /Volumes/xxxx/Users/xxxx/Library/Application Support/Local/lightning-services/mysql-8.0.16+6/bin/darwin/bin/mysqladmin ping
amysqladmin: connect to server at ‘localhost’ failed
error: ‘Can’t connect to local MySQL server through socket ‘/Volumes/xxxx/Users/xxxx/Library/Application Support/Local/run/S9lZAFtYh/mysql/mysq’ (2)’
Check that mysqld is running and that the socket: ‘/Volumes/xxxx/Users/xxxx/Library/Application Support/Local/run/S9lZAFtYh/mysql/mysqld.sock’ exists!

at ChildProcess.exithandler (node:child_process:430:12)
at ChildProcess.emit (node:events:513:28)
at ChildProcess.emit (node:domain:489:12)
at maybeClose (node:internal/child_process:1091:16)
at ChildProcess._handle.onexit (node:internal/child_process:302:5)

After I click OK, it pops up asking me to allow host redirection on the MAC, which I do, I put my password in for “Local wants to make changes” and click OK. However, when I try again I still get the same error.

I have the same issue. I’ve tried changing it to local host, but the issue persisted. Can anyone assist me with getting this fixed?

Here is a screenshot of the error message:

Hi @Yolandi and @adz

Just an FYI that MacOS 10.13 is not compatible with the latest releases and PHP versions in Local per our minimum requirements.

If you’ve updated your OS and are still running into this problem, check and see if you can create a new, blank site in Local and access that okay. If you can then you may want to try and reimport the site having the problems.

The steps would look like this:

  • Locate the site files on your machine, and save a copy of them to your desktop. If you click Go to Site Folder under your site name it should take you right to where they are located.
  • Once you have those copied, completely delete the site from Local
  • Restart Local/your machine
  • Reimport the site back into Local. You can refer here on how to Restore from only Local site files

I get the same issue with different sites and it’s so random that I can’t even predict which ones and why. I had 5 site working yesterday that no longer worked today and would throw a bunch of different errors (including the one above). Update the Local to latest version, tried changing route mode as suggested. Only one of sites has launched, another one launched from like a tenth attempt and 3 others are not working. The error shows up 3 times

While some sites have these issues, some other site launch just fine or work after 2 or 3 attempts.

I managed to clone the site and everything is again working as it should. I’m not pushing hard to finish the build before I run into any other weird issues.

2 Likes

Something else you can try to do is stop all sites in Local, quit Local, and then restart your machine and go back in. If that doesn’t clear things up then you can try cloning or reimporting the sites throwing errors to get them working again.

I tried restarting, it helps sometimes. But I have to recreate about 10 sites every single month because of these issues. This is a lot of extra unreasonable work.

Generally, when this happens, it’s because something is interfering with the connection. Possibly something didn’t get fully cut off. Some things you could try:

  • Make sure before quitting Local to stop all your sites.

  • Check to see if you are using any Local add ons. Like Image Optimizer. Sometimes disabling these will help.

  • Are you running other developer applications simultaneously? That could also cause similar issues. Apps like MAMP, XAMPP, or Docker for example.

  • You can try changing your Router Mode to see if that makes a difference as well: Preferences>Advanced>Router Mode

I make sure to stop all the sites before quitting, I don’t use any add-ons and I’m not running any other development tools.
When switched the router mode, none of sites worked at all. I had to switch back and restart computer to make it work again, but half of the sites still had the same mysql error shown above

Hi @rilel

Are you on Windows?

What types of security/antivirus/firewall applications do you have installed?

Does this issue primarily happen after an update of Local? After the update if you downgrade back down does it resolve? Downgrade Local Version - Local