0

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
5
  • Does this file exist? /var/run/mysqld/mysqld.sock Delete it. It is a stale socket file. Then try to start.
    – user8290
    Jan 3, 2012 at 0:08
  • mysqld directory is already empty =(
    – user784637
    Jan 3, 2012 at 0:13
  • Hmm? This is for the socket file. 'ls -la /var/run/mysqld/mysqld.sock' Got it? Delete it.
    – user8290
    Jan 3, 2012 at 0:21
  • already tried that =(
    – user784637
    Jan 3, 2012 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, 2012 at 0:29

5 Answers 5

2

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

1
  • not working for me.
    – LoveToCode
    Jul 29, 2016 at 5:14
1

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

0
0

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.

2
  • 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, 2012 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, 2012 at 18:15
0

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.

-2

type this in a terminal

mysql -u root -p

then enter your password

1
  • I can't, it brings up the same error message as above when I try to do that.
    – user784637
    Jan 3, 2012 at 17:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .