1

As the title suggests the error I receive when I try to start MySQL from the terminal:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (2)

I receive this error when I run:

/Applications/MAMP/Library/bin/mysql -u root -p

I don't receive this error when I run:

mysql -u root -p

BUT the problem is when I run mysql -u root -p it connects to the wrong mySQL...

On my OSX I have two users, the main user (the one I am getting the error on) accesses its own instance of mySQL (which is empty) when running the above command. The secondary user accesses a different instance of mySQL (the one with the desired data) when I run that command. The problem of course being that I am trying to access the secondary users MySQL instance while on the main user (which I should note I was doing earlier until I logged off, and now i have this error)

Further I should mention that MAMP was installed on the secondary user (even though MAMP files can be accessed from either user); and when using the MAMP gui to 'Start Servers' no issues occur on the secondary user, but on the main user Apache Server starts, but MySQL Server does not start.

From searching I heard it was a good idea to run a killall -9 mysqld / killall mysqld and try everything again (which made sense) -- which i did with no success. Further I saw that you should run two other commands for debugging purposes -- I don't know what they mean, but I would like to =D :

ps -u mysql

which returned:

UID   PID TTY           TIME CMD

and

ps -awwx | grep mysql

which returned:

8001 ??         0:00.03 /bin/sh /usr/local/opt/mysql/bin/mysqld_safe --bind-address=127.0.0.1 --datadir=/usr/local/var/mysql
16527 ??         0:00.43 /usr/local/Cellar/mysql/5.6.21/bin/mysqld --basedir=/usr/local/Cellar/mysql/5.6.21 --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/Cellar/mysql/5.6.21/lib/plugin --bind-address=127.0.0.1 --log-error=/usr/local/var/mysql/MacBook-Pro.local.err --pid-file=/usr/local/var/mysql/MacBook-Pro.local.pid
81182 ??         0:00.04 /bin/sh /Applications/MAMP/Library/bin/mysqld_safe --port=8889 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-error=/Applications/MAMP/logs/mysql_error_log
18520 ttys002    0:00.00 grep mysql
Mazzone
  • 350
  • 1
  • 3
  • 20
  • 1
    http://stackoverflow.com/a/22431434/552116 – Ghostman Apr 03 '15 at 05:49
  • @soul I actually already tried both posted answers. The first gives me an error saying "There is a problem with the server ports. Each server must be assigned a unique port. Please check config." And the second posted answer has a 'try' then if passes 'fix'; but mine fails on the try with the noted error -- i actually left a comment on that post earlier when i was searching – Mazzone Apr 03 '15 at 06:08

0 Answers0