When I try to run mysql from the command line I get the following:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
interestingly the php scripts that connect to mysql in /var/www appear to be connecting just fine and when I stop MySQL these scripts can no longer connect as expected. However when I start mysql I continue to get the missing .sock error from the command line while my php scripts once again are connected to the database they are supposed to.
I have tried restarting mysql in various ways (restarting, starting then stopping, sudo pkill mysql) and still no luck. The only sock file on my system is /run/mysqld/mysqld.sock; but, without being sure that this is the cause of the command line error I dont want to haphazardly make symbolic links in my /tmp directory.
How can I resolve the issue of connecting to mysql via the command line? some suggestions I have read recommend reinstalling MySQL which I don’t want to do considering my php connection is working.