Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've been struggling with this issue for a really long time. Can someone please advise me on how to get mysql working?

root@me:~# start mysql
start: Job is already running: mysql
root@me:~# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

What boggles the mind is that it shows no mysql processes being run even though the above bash says otherwise.

~# ps -ef | grep mysql
root      8968  1631  0 15:24 pts/0    00:00:00 grep --color=auto mysql
share|improve this question
    
Does this file exist? /var/run/mysqld/mysqld.sock Delete it. It is a stale socket file. Then try to start. –  user8290 Jan 3 '12 at 0:08
    
mysqld directory is already empty =( –  user784637 Jan 3 '12 at 0:13
    
Hmm? This is for the socket file. 'ls -la /var/run/mysqld/mysqld.sock' Got it? Delete it. –  user8290 Jan 3 '12 at 0:21
    
already tried that =( –  user784637 Jan 3 '12 at 0:36
    
OP are you still looking for an answer? If so, you may need to repost your question as this is flagged for closure. Regards, –  Ringtail Mar 28 '12 at 0:29

5 Answers 5

check following steps:-

1) in my.cnf check the scoket location

2)check the mysql data directory permissions .

3)use following if u don't have password mysql -uroot -p password:just press enter

share|improve this answer

use the command sudo nano /etc/mysql/my.cnf and change the bind address to your local host or 127.0.0.1 then save and close the my.cnf window.

Then run the below command

sudo service mysql start

then try login mysql -u root -p

share|improve this answer

In spite of it seems that using start and stop it is the new standard way to launch daemons, I still prefer the old way (in fact, I think that the new way never worked for me) so I stopped trying to use it):

/etc/init.d/mysql start

Have you tried it? Because it looks like start it isn't starting mysql as ps showed.

share|improve this answer
    
Yeah I get an error message that says it won't work using that method and I have to use the "service mysql start" –  user784637 Jan 3 '12 at 17:41
    
I get a message like that, but it starts anyway. Have you tried ps -ef | grep mysql after /etc/init.d/mysql start. –  lafdez Jan 3 '12 at 18:15

just type this code in terminal

sudo opt/lampp/bin/mysql -u root

or

sudo opt/lampp/bin/mysql -u root -p

if you have set a password.

share|improve this answer

type this in a terminal

mysql -u root -p

then enter your password

share|improve this answer
    
I can't, it brings up the same error message as above when I try to do that. –  user784637 Jan 3 '12 at 17:41

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.