Not sure how to fix this but here is the description. I can run the command to a Lampstack MySQL installation like this and it works:
/opt/lampstack/mysql/bin/mysql -u root -p
And my PATH variable has this path in it, but yet this command doesn't work:
mysql -u root -p
Gives this error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
The command asks for password but then gives the error.
I should note as well that running phpMyAdmin works fine at localhost:9090
with root
and correct password.
Presumably, there are two MySQL installations getting confused, because I can run each command with --version
and I get two distributions: 5.5.32 and 5.5.21.
This is a problem because I'm trying to use the Lampstack MySQL installation for a Django project. I have this configuration running on Windows but in an attempt to duplicate the environment on Ubuntu I've gotten a bit mixed up.
What is the best way to resolve this issue without removing the core MySQL on the Ubuntu system (and use the Lampstack one)?
NOTE
I discovered that the /var/run/mysqld/mysqld.sock
doesn't actually exist and nor does the directory /var/run/mysqld
. I'm not sure how to fix this so any assistance is appreciated.
Check in which order in the
PATH
your/opt/lampstack/mysql/bin/
. Is it before or after the nativemysql
binary? Run ato confirm. Make sure that
/opt/lampstack/mysql/bin/
appears BEFORE the other path.When trying to determine if something is accessible on your
$PATH
it's always best to use the commandtype
.Example