Advertise on Site! You can Advertise on our site. Find out More

Solved issue: Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock

[root@localhost ~]# mysqladmin -u root shutdown
mysqladmin: connect to server at ‘localhost’ failed
error: ‘Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)’
Check that mysqld is running and that the socket: ‘/var/lib/mysql/mysql.sock’ exists!

Using following command I checked the mysql directory.
[root@localhost ~]# ll /var/lib/mysql/

I did not found the mysql.sock file there.

[root@localhost ~]# cd /var/lib/mysql/
Created file in that location.
[root@localhost mysql]# touch mysql.sock
Gave the executabe permission the sock file.
[root@localhost mysql]# chmod +x mysql.sock
Changed the permission to mysql user
[root@localhost mysql]# chown mysql:mysql -R *

After that restarted the machine
[root@localhost mysql]# /etc/init.d/mysqld start
Starting mysqld:                                           [  OK  ]
[root@localhost mysql]# mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.52 MySQL Community Server (GPL) by Remi

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> show databases;

  • Pingback: Tweets that mention Solved issue: Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock | Wordpress API -- Topsy.com

  • http://rapidgigabitz.com/ free software download

    i like it Solved issue: be able to’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock | WordPress API now im your rss reader

  • http://rapidgigabitz.com/ free crack adobe

    i fine it Solved event: Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock | WordPress API now im your rss reader

  • Pingback: Képfeltöltés és méretezés | Prog

  • http://myincebridesiteforyou.jp/ Hedy Maupredi

    I’d forever want to be update on new blog posts on this web site , saved to bookmarks ! .

  • http://holidaystream.com Elizbeth Tommolino

    I’ve just started off a blog, the knowledge you give on this site has aided me extremely. Thank you for all your time & work.

  • http://affiliatetown.info Conrad Mclaws

    Hello, this is my first time i visit here. I found so many interesting in your blog especially on how to determine the topic. keep up the good work.

  • http://build-muscles.info Shery Fraize

    I was just having a conversation over this I am glad I came across this it cleared some of the questions I had.

  • http://paid2surveys.info Anibal Mehr

    Nice post! You truly have a wonderful way of writing which I find captivating! I will definitely be bookmarking you and returning to your blog. In fact, your post reminded me about a strange thing that happened to me the other day. I’ll tell you about that later…

  • http://treatment-hair-loss.info Mertie Norwell

    I’ve just started off a blog, the knowledge you give on this site has aided me extremely. Thank you for all your time & work.

  • http://www.weightloss2ublog.com Myles Glaue

    I REALLY liked your post and blog! It took me a minute bit to find your site…but I bookmarked it. Would you mind if I posted a link back to your post?

  • http://affiliatetown.info Venessa Listen

    Awesome post. I so good to see someone taking the time to share this information

  • http://affiliatetown.info Magaret Likar

    This post makes a lot of sense !

  • http://menquitsmoking.com/ Jayson Breitling

    I’ve been checking your blog for a while now, seems like everyday I learn something new :-) Thanks

  • Yuri

    sorry, it doesn´t work on mysql/fedora the problem persist

  • rajkumar

    still i have same issue in fedora15