1

Since I've updated my Mac to the lastest OS version (Ventura 13.2) and I'he made some cleanup (hopefully I didn't remove any important file). I can't connect to mySql

I've insatlled mysql with brew (long before this update) and it always has worked fine.

When I run brew services start mysql in my terminal it looks to work (Successfully started mysql (label: homebrew.mxcl.mysql))

But, as soon as I run mysql -u root -p and I enter my password I have the following error message ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

When I explore /tmp directory I see that /tmp/mysql.sock is a symlink to /var/lib/mysql/mysql.sock but mysql directory doesn't exist in /var/lib.

After extensive research I didn't find how to "get" this directory.

I've found many entries in StackOverflow with the same title, I've tried almost all answer but none seems to work. especialy in my case I'm using brew and macOS ventura. Typicaly for ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' the accepted answer is not about brew.

I've tried brew reinstall mysql.

I've tried as well mysql -h 127.0.0.1 -u root -p in this case the error is ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1:3306' (61).

I've tried to run mysqld and then brew services start mysql, in this case I have the following error

Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
Error: Failure while executing; `/bin/launchctl bootstrap gui/502 /Users/CedMacBook1/Library/LaunchAgents/homebrew.mxcl.mysql.plist` exited with 5.

I've tried to change my password using sudo mysqladmin -u root password -p and once again I have the error error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'.

It looks like mysql is runningm, I've ran ps aux | grep mysqld and get the following line: CedMacBook 21853 0,0 0,0 34400496 2728 s000 S+ 7:53 0:00.01 grep mysqld

Finally I've checked my /usr/local/etc/my.cnf and I have the following

# Default Homebrew MySQL server config
[mysqld]
socket=/tmp/mysql.sock
# Only allow connections from localhost
bind-address = 127.0.0.1
port=3306
mysqlx-bind-address = 127.0.0.1

At this stage I'd be happy to swipe out everything... if I could save all my database

Please help, I don't know what else to try

Cedric Cholley
  • 1,956
  • 2
  • 9
  • 15
  • Your ps aux is showing you your own grep command. I'd suggest that mysql isn't running at this point. Try ps aux | grep -v grep – FreudianSlip Feb 20 '23 at 09:17
  • I did run `ps aux | grep -v grep` it returns a very long list of process, how do I know if mysql is running ? I've search for "mysql" I've found only one line: `_mysql 77540 0,1 0,7 409767600 438416 ?? Ss 9:45 0:12.81 /usr/local/mysql/bin/mysqld --user=_mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/usr/local/mysql/data/mysqld.local.err --pid-file=/usr/local/mysql/data/mysqld.local.pid --keyring-file-data=/usr/local/mysql/keyring/keyring --early-plugin-load=keyring_file=keyring_file.so` – Cedric Cholley Feb 20 '23 at 09:42
  • ah sorry - my mistake - I meant to say : ps aux | grep mysql | grep -v grep – FreudianSlip Feb 20 '23 at 11:41

1 Answers1

0
brew services start mysql

If this doesn't work then reinstall mysql.