0

Suddenly after restarting the machine, I have been facing this error can't connect to MySQL server and table plus is not able to connect with localhost 127.0.0.1.

The steps below worked for me, and can probably work for you, too! However, you will need to install HomeBrew if you don’t have it already.

brew doctor brew remove mysql 

Above remove mysql will not remove databases, So you can easily run the above commands.

brew install mysql 

Once you installed the latest version of mysql then try to see the folder of mysql installation by running

which mysql 

It should show like this one "/opt/homebrew/bin/mysql" The final step should be writable permissions for the mysql var folder by running

chmod -R 0777 /opt/homebrew/var/mysql 

This has resolved socket and PID error for me.

1 Answer 1

0

I got this error yesterday when trying to connect to my mysql database after getting it running. There is a lot of conflicting information on the web due to how you download mysql, versions, which OS you’re on, etc.

The steps below worked for me, and can probably work for you, too! However, you will need to install HomeBrew if you don’t have it already.

brew doctor brew remove mysql 

Above remove mysql will not remove databases, So you can easily run the above commands.

brew install mysql 

Once you installed the latest version of mysql then try to see the folder of mysql installation by running

which mysql 

It should show like this one "/opt/homebrew/bin/mysql" The final step should be writable permissions for the mysql var folder by running

chmod -R 0777 /opt/homebrew/var/mysql 

This has resolved socket and PID error for me.

Thanks

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.