When I try to log into the mysql shell with:
mysql -u root
then I get:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
How do I log onto the mysql shell?
I have been googling this left and right and trying all those proposed solutions on stackoverflow and elsewhere but nothing seems to work.
I have tried adding -p
at the end. Same error.
I have tried going by this: https://stackoverflow.com/questions/11657829/error-2002-hy000-cant-connect-to-local-mysql-server-through-socket-var-run The first answer, I already have mysql-server installed. The second answer doesn't work. The third answer, i cannot implement step no. 3:
mysql -u root
and in the second step the process just hangs with message:
mysqld_safe Logging to syslog.
2017-09-26T16:30:40.563159Z mysqld_safe Logging to '/var/log/mysql/error.log'.
2017-09-26T16:30:40.566955Z mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't exists.
So the question is, how do I log onto the mysql shell?
ps -ef | grep mysqld
give you? Specifically, I'm looking for the value of the--socket
parameter of the running mysqld process