Skip to content

Instantly share code, notes, and snippets.

@seemly
Created May 24, 2021 08:32
Show Gist options
  • Save seemly/fc9bf6023cfb333fc336a0363f536ea0 to your computer and use it in GitHub Desktop.
Save seemly/fc9bf6023cfb333fc336a0363f536ea0 to your computer and use it in GitHub Desktop.
Apple M1 - Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Setting up my new Apple M1 macbook pro I was having issues setting up mysql@5.7 using homebrew, with the following message being thrown:
```
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
```
We need to modify the MySQL config file:
```
nano /usr/local/etc/my.cnf
```
Append the following lines:
```
tmpdir=/tmp
user=root
```
Then run:
```
brew services restart mysql@5.7
```
You should now have no issues.
@Thrry
Copy link

Thrry commented Mar 15, 2022

thank you so much

@seemly
Copy link
Author

seemly commented Mar 15, 2022

thank you so much

No problem. I'm glad it helped.

@serg2801
Copy link

serg2801 commented Feb 9, 2023

thanks works for me

@seemly
Copy link
Author

seemly commented Mar 17, 2023

thanks works for me

Woop! Fantastic. I'm glad it helped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment