Archive Pages Design$type=blogging

ERROR 2002 (HY000): Can't connect to local MySQL server

MAMP is for Mac what XAMPP is for windows: A very easy-to-use, but Mac-like web development solution. Everything worked out-of-the box as it should – until I tried to install WordPress on my MacBook. I got a database connection error very early during the WordPress installation process.

So I tried to talk to the mysql server with the mysql command line tool and got this error message: macbook:~ sf$ /Applications/MAMP/Library/bin/mysql -u root -p Enter password: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Just Run : sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock
and Restart your mamp server ....
This was strange as the mysql server was indeed running; I could verify this by an ps command. Futhermore phpMyAdmin, as provided by MAMP, worked flawlessly. Doing some Google research told me that the problem was connected with the location of mysql.sock.
Running ps -awwx | grep mysql showed, that mysqld had been started by MAMP with the option --socket=/Applications/MAMP/tmp/mysql/mysql.sock, whereas the mysql tool and WordPress assume the socket file here: /tmp/mysql.sock.
With this information the solution is easy: sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock This creates a symbolic link from the location expected by mysql and wordpress to the location where the socket file resides. Now I can access my mysql server with the mysql command line tool and my local WordPress installation can also talk to the database.
Name

MAMP movies MYSQL MySQL Interview Questions news php PHP Interview Questions React React Advaced Questions reviews slider Top 50 React Interview Questions Tutorial tutorials UFW
false
ltr
item
CodeVizz: ERROR 2002 (HY000): Can't connect to local MySQL server
ERROR 2002 (HY000): Can't connect to local MySQL server
CodeVizz
https://www.codevizz.com/2018/11/error-2002-hy000-cant-connect-to-local.html
https://www.codevizz.com/
https://www.codevizz.com/
https://www.codevizz.com/2018/11/error-2002-hy000-cant-connect-to-local.html
true
3366176187658761010
UTF-8
Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago