Connecting Tech Pros Worldwide Forums | Help | Site Map

Can't connect to local MySQL server through socket on Ubuntu.

Member
 
Join Date: Sep 2007
Posts: 121
#1: Sep 27 '08
Hi friends,
I installed mysql in ubuntu but, i don't know how to connect to that mysql. Actually we connect to postgresql by psql command, but when i tried to connect mysql with mysql command but it displaying this error:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

when i give mysql databasename it displaying the following error:

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

So friends, what is the solution for this problem?

Atli's Avatar
Moderator
 
Join Date: Nov 2006
Location: Iceland
Posts: 3,748
#2: Sep 27 '08

re: Can't connect to local MySQL server through socket on Ubuntu.


Hi.

I would guess that your MySQL service is stopped. It needs to be started before you can start using it.

On Ubuntu, this command should start it up:
Expand|Select|Wrap|Line Numbers
  1. sudo /etc/init.d/mysql start
P.S.
Please try to give your threads descriptive titles, so that they can be found by others with similar problems and so the experts can quickly find threads they can help with.

If your having trouble doing that, try using phrases you would be likely to use when searching for an answer in a search engine, like Google.
You should also check out the Posting Guidelines for more tips on how to construct a good thread title.

Thank you.
Moderator
Reply