L
L
lagudal2021-01-27 10:41:50
MySQL
lagudal, 2021-01-27 10:41:50

How to fix sudden error 2002 (HY000) mysql - mariadb under Mac OS Big Sur?

Given - local server, under Mac OS Big Sur, nginx, mariadb, php-fpm , everything was installed with homebrew .
Installed and working for a long time, since the spring from the first quarantine days, the last time everything was updated in October after updating the system to Big Sur. Until today, everything worked like clockwork, this morning I open it in the browser and get an error:

PDOException: SQLSTATE[HY000] [2002] No such file or directory in /usr/local/.....

I try to log in through the console -
mysql -u root -p
in response I get:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Wherein
@Alexanders-MacBook-Pro var % mysqladmin -u root -p status
Enter password: 
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!

checking
@Alexanders-MacBook-Pro /tmp % mysqld --help --verbose | grep sock

Answer
socket                                                       /tmp/mysql.sock
unix-socket                                                  ON

I went through Google, but so far nothing has helped, here is the last similar question on stackoverflow quite recently, apparently without a solution yet.
The problem seems to be one to one, but there the person after the update, and I didn’t update anything yesterday, at least I didn’t update anything manually.
I don't really want to demolish and re-install mysql ..

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Karasik, 2021-01-27
@vitaly_il1

try restarting, or first check if
brew services status mysql is running
then stop / start

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question