2

I am having problem accessing my database,

when I try to run mysql -h localhost -u root -p and enter the password

I am recieving this kind of error

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

Wonder why I get this.

When I type mysql --version

I have no error and got this msg: mysql Ver 14.14 Distrib 5.5.22, for debian-linux-gnu (x86_64) using readline 6.2

But when I type this comman mysql -v I got an error that says:

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

I thought mysql --version and mysql -v are desame

Any help will be much appreciated.

Thank you

1
  • -v, --verbose Write more information. -V, --version Output version information and exit. So you had a lower case v and had to had a capital V to make the statement: "mysql --version and mysql -v are desame" Commented Oct 17, 2012 at 9:17

1 Answer 1

2

I get that error when the MySQL service isn't running. What OS are you on? I'm on Debian GNU/Linux, so I start the service with

# service mysql start

but other systems may use something different, like start or invoke-rc.d or something.

Sign up to request clarification or add additional context in comments.

6 Comments

Thank you for your reply. I run that code and got this message start: Rejected send message, 1 matched rules; type="method_call", sender=":1.52" (uid=1000 pid=18021 comm="start mysql ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init") any idea?
Have a look at some of the posts here: ubuntuforums.org/showthread.php?t=1469902&page=2 One suggestion from there: have you run out of disk space?
Nope I check my disk space and it is only about 40%.
First, check to be sure that the service is actually not running (ps -ef | grep mysql should do it, but also check if that socket exists). If it isn't running, then that's the answer to this question, and you need to figure out why it isn't starting. If it is already running, then there is indeed a problem to solve here.
It is running but, the socket is not there. in /var/run/mysqld/ directory there is no mysqld.sock. How do I recover or generate the mysqld.sock?... Thank you
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.