0

I installed MySQL and forgot my root password (Mac OSX El Capitan).

I am using the tutorial by [Ubuntu][1] to reset my password but I am having issues very early

I type sudo /usr/local/mysql/support-files/mysql.server stop

And get sudo: /usr/local/mysql/support-files/mysql.server: command not found

I move forward anyway and type:

sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &`
mysql -u root

And I get

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

[1]+  Stopped                 sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking

Any suggestions? (NEVERMIND- FIGURED IT OUT, I POSTED ANSWER BELOW)

degenPenguin
  • 725
  • 1
  • 8
  • 23

1 Answers1

0

Hmm.. Interestingly, a big part of this problem is the lack of knowledge and information. So I found this question For a newbie: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' after searching for the bottom error solution.

The solution said it may be installed but not running. Suggested typing brew info mysql

Turns out, I never set a root password.

And so, I started mysql so I could set a root password. I typed brew services start mysql (reqs homebrew)

Next:

$ mysql -u root
mysql> USE mysql;
mysql> UPDATE user SET authentication_string=PASSWORD("NEWPASSWORD") WHERE User='root';    mysql> FLUSH PRIVILEGES;
mysql> quit

Switch NEWPASSWORD with your new password (thanks https://stackoverflow.com/a/6474890/4330767)

Should fix now.

Community
  • 1
  • 1
degenPenguin
  • 725
  • 1
  • 8
  • 23
  • 1
    I don't think there is a lack of information, just finding it in the sea of permutations – Drew Sep 13 '16 at 17:29