PDA

View Full Version : [ubuntu] [SOLVED] mysql ERROR 2002



Papa_Bear
December 11th, 2008, 04:28 PM
Hello. I've just installed mysql using apt-get but when I type mysql -u root the terminal says:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

I've checked the /var/run/mysqld/ and nothing is in there.

What should I do?

bluefrog
December 11th, 2008, 04:32 PM
is mysql-server installed?

what's the output of
dpkg -l mysql* | grep ii | awk '{ print $2 }'

albandy
December 11th, 2008, 04:32 PM
type mysql -u root -p
and like said bluefrog, are you sure you've installed mysql-server package?

Papa_Bear
December 11th, 2008, 04:43 PM
Hey, thanks for replying.

The output of dpkg -l mysql* | grep ii | awk '{ print $2 }' is:

mysql-client-5.0
mysql-common
mysql-server
mysql-server-5.0

When I type mysql -u root -p the terminal asks me for a password, but I still haven't entered a password for mysql. When I type a random password I get the same ERROR 2002 message...

bluefrog
December 11th, 2008, 04:47 PM
sudo invoke-rc.d mysql restart

and what's the output of that? any errors?

Papa_Bear
December 11th, 2008, 04:49 PM
I don't know if it is worth mentioning but I changed the bind-address in the my.cnf file into my ip address.:confused:

Papa_Bear
December 11th, 2008, 04:52 PM
Thanks for helping man.. This is it's output:

* Stopping MySQL database server mysqld [ OK ]
* Starting MySQL database server mysqld [fail]
invoke-rc.d: initscript mysql, action "restart" failed.

albandy
December 11th, 2008, 04:52 PM
If there's no data reinstall it

bluefrog
December 11th, 2008, 04:53 PM
then change it back to 127.0.0.1 and see what it does from there.

Papa_Bear
December 11th, 2008, 04:59 PM
I've tried reinstalling it but I got the same results.
I've changed the bind-address back but I still get the same error.

Isn't there something I should put in the /var/run/mysqld ?

bluefrog
December 11th, 2008, 05:02 PM
dpkg -l mysql* | grep ii | awk '{ print $2 }' | sudo xargs apt-get remove --purge -y && sudo apt-get install mysql-server

Papa_Bear
December 11th, 2008, 05:13 PM
Alright! Thanks bluefrog! I've got it running now. Hehehe.:guitar:

peternz
December 16th, 2008, 09:13 PM
Bluefrog, worked for me too.

Genius.

SLightly worried that I don't understand the commands I just put my server through, but it's a small price to pay. :)

bennis
March 15th, 2009, 09:05 PM
Never mind, forgot about page two...