Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

Tom,

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

[mysqld]
socket=/path/to/socket

[client]
socket=/path/to/socket

Edit:

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.

share|improve this answer
    
socket = /opt/lampp/var/mysql/mysql.sock there is nothing called mysql.sock in that folder, however. –  Tom 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) –  Tom 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? –  Tom 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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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