[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2106
  • Last Modified:

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) Problem

I'm really desperated with this problem, please someone help me, is very URGENT!!!

I have mysql installed over linux box. I  have phpmyadmin 2.6 installed on it.  I changed the pwd of root user, but I didn't know that account was related to a VERY IMPORTANT application. I tried to change the pwd in the application, but it told me: Access denied for user 'root'@'localhost' (using password: YES)  .

Then I tried changing the pwd back, shutting down the mysqld service and restarting it with --skip-grant-tables and after that I created a file with the following text:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('mypwd'). I named the file mysql-init and then run:
mysqld_safe --init-file=~/mysql-init &

It seemed to work fine, it displayed:
[root@declaranet bin]#  mysqld_safe --init-file=~/mysql-init &
[1] 30618
[root@declaranet bin]# Starting mysqld daemon with databases from /var/lib/mysqlSTOPPING server from pid file /var/run/mysqld/mysqld.pid
060428 15:05:46  mysqld ended

but it doesn't return to the prompt, it keeps there after more than 30 minutes.

Then in another terminal I try  mysql -u root but it sends me the error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

I really don't know what to do... It's VERY IMPORTANT and needs to be solved today.

Please, can someone help me???

Any help will be appreciated.
  • 2
2 Solutions
The error message is really telling you that MySQL isn't running. Probably the way you are trying to start it isn't appropriate for your flavour of linux. The first place to check is the mysql log (probably in /var/log/mysql). If you're running Redhat try "service mysqld restart".

You might also want to try killing all instances of mysql first, in case an old one is hanging around screwing things up (try "killall mysql" or "pgrep mysql" followed by kill -9 <mysql process number>).

Alternatively, tell me what flavour of linux you're running and I can provide more detailed information.


bethzycbAuthor Commented:
Thanks patspam...

You were right, the problem was with mysql not running, it seemed we had a problem with the daemon or something like that, furthermore, the password provided was wrong, that's one of the biggest problems, but we could make things work...

Thanks both of u, the links Yuval_Shohat  provided gave us some light...

Glad you got it working :)



Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now