Created
June 7, 2018 17:31
-
-
Save kanikash4/efc7ff99aca4b8a41f8626ac771d5d8a to your computer and use it in GitHub Desktop.
Mysql Error: ERROR 2002 (HY000)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mysql installed but throwing error while using command `mysql -u root -p` | |
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) | |
But while checking in `/tmp/mysql.sock` there is no mysql in tmp | |
Perform the following steps: | |
1. sudo chown -R _mysql:mysql /usr/local/var/mysql | |
It will prompt for system password, enter the password. | |
2. sudo mysql.server start | |
Starting MySQL | |
.Logging to '/usr/local/var/mysql/kanikasharma-MacBook-Pro-2.local.err'. | |
. SUCCESS! | |
Now access with `mysql -u root -p` | |
If forgotten the password, go through the below mentioned steps: | |
1. mysql -u root | |
2. mysql> USE mysql | |
3. mysql> UPDATE mysql.user SET authentication_string=PASSWORD("<new-password>") WHERE User='root'; | |
4. mysql> FLUSH PRIVILEGES; | |
5. Exit it and re open in other tab. | |
It works ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
One more way found:
brew services start MySQL
It will successfully start MySQL service. Now you can connect to the server.
2.
mysql -uroot