What should happen:

./lampp start mysql -u root -p

--All is right and well with the world!--

What actually happens, and in this order:

./lampp start

mysql -u root -p

[Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)]

{at this point, phpmyinfo() shows mysql as activated}

sudo service mysql start

mysql -u root -p

[Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)]

{phpmyinfo() still shows mysql as activated}

./lampp stop

mysql -u root -p

(all is right and well with the world!)

./lampp start

Another MySQL daemon is already running...

{phpmyinfo() shows mysql as deactivated}

Basically, it seems there's some conflict going with mySQL. If I have apache running, I can't run mysql, but if I have mySQL running, I can't load it in Apache. The error remains the same. Both are trying to use the same socket, and it works if Apache isn't running. Any suggestions all would be extremely appreciated.



check your my.cnf for the path to the socket file under the mysqld and client section.




If the [client] section doesn't exist then put it there so you don't have to manually specify the --socket=path when connecting from command line.

  • socket = /opt/lampp/var/mysql/mysql.sock there is nothing called mysql.sock in that folder, however. – Thomas Thorogood Apr 11 '11 at 17:37
  • When connecting try using mysql --socket=/opt/lampp/var/mysql/mysql.sock -u root -p – Sameer Apr 11 '11 at 17:45
  • ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) – Thomas Thorogood Apr 11 '11 at 17:51
  • Tried a few times, typing my password carefully. But at least it's a different error! Any idea what I can edit so I don't have to do that manually every time? – Thomas Thorogood Apr 11 '11 at 17:52
  • Try without the -p maybe the password is not set yet. To not have to enter the socket path see the answer. I editted it to include the solution. – Sameer Apr 11 '11 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.