Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 13 of 13
  1. #1
    Member
    Join Date
    Jul 2003
    Posts
    26

    Unhappy MySQL Sock Error - Existing threads no help

    I know there are already loads of threads about MySQL.Sock errors, but I have read through all of the ones I could find and none of them helped me.

    I have just restored my server from the old HD and everything seems to be working now apart from MySQL, giving me the error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

    I can't seem to find a myqsl.sock file anywhere, I looked in /tmp, /var/tmp, /var/lib/mysql.

    I have tried /scripts/fixmysql and that doesn't help, nor does /scripts/mysqlup --force

    Is there anyway to recreate a mysql.sock file? Is it just a text file with some data in?

    Anyone have any ideas on something to try?

    Thanks for any replies

  2. #2
    Super Moderator This forum account has been confirmed by cPanel staff to represent a vendor. chirpy's Avatar
    Join Date
    Jun 2002
    Location
    Go on, have a guess
    Posts
    13,495

    Default

    A few things to try:

    1. Make sure /var and /tmp aren't full!

    2. Ensure the file ownerships are correct:

    chown -R mysql:mysql /var/lib/mysql

    3. Check that /tmp is chmod 1777:

    chmod 1777 /tmp

    4. Pre-create the symlink in /tmp:

    ln -sv /var/lib/mysql/mysq.sock /tmp/mysql.sock

    5. Lastly, check /etc/my.cnf and edit it so that it only has these lines in it:
    Code:
    [mysqld]
    set-variable = max_connections=500
    safe-show-database
    That pretty much covers all the cases I've found for the problem. If it still doesn't work:

    /scripts/mysqlup --force
    Jonathan Michaelson

    Need your cPanel servers secured and tuned?
    cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
    Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
    http://www.configserver.com

  3. #3
    Member
    Join Date
    Jul 2003
    Posts
    26

    Default

    Thanks, I've tried all of those and still doesn't work.

    /tmp wasn't full, but I emptied out a few files. What/where can I clear out in /var ?

    Is there a way I can force mysql.sock to be created? Or manually make one? Or copy one from another machine? It doesn't seem to be making it.

    Any other ideas?

  4. #4
    cPanel Partner NOC cPanel Partner NOC Badge AndyReed's Avatar
    Join Date
    May 2004
    Location
    Minneapolis, MN
    Posts
    2,223

    Default

    Quote Originally Posted by dempsey
    Thanks, I've tried all of those and still doesn't work.

    /tmp wasn't full, but I emptied out a few files. What/where can I clear out in /var ?

    Is there a way I can force mysql.sock to be created? Or manually make one? Or copy one from another machine? It doesn't seem to be making it.
    That's very odd. Are you sure MySQL is installed, or installed properly, on the new server?
    Andy Reed
    RHCE and CCNA
    ServerTune.com

  5. #5
    Member
    Join Date
    Jul 2003
    Posts
    26

    Default

    Quote Originally Posted by AndyReed
    That's very odd. Are you sure MySQL is installed, or installed properly, on the new server?
    its the same server, just a new HD, I think it's installed properly, I've tried forcing an update, but how can I try reinstalling it completly?

  6. #6
    cPanel Partner NOC cPanel Partner NOC Badge AndyReed's Avatar
    Join Date
    May 2004
    Location
    Minneapolis, MN
    Posts
    2,223

    Default

    Quote Originally Posted by dempsey
    its the same server, just a new HD, I think it's installed properly, I've tried forcing an update, but how can I try reinstalling it completly?
    Still, make sure MySQL is installed properly.

    Login to WHM and change the root password for MySQL. Then run these commands:
    chmod 1777 /tmp
    ps aux |grep mysql
    killall -9 mysql
    ln -s /var/lib/mysql/mysql.sock /var/tmp/mysql.sock
    chown -R mysql:mysql /var/lib/mysql
    /scripts/restartv mysql

    Check on errors:
    tail -f /var/log/mysqld.log

    If that doesn't work, try this command:
    /scripts/mysqlup --force

    If that doesn't work, I suggest you hire a sys admin to fix this problem for you.
    Last edited by AndyReed; 01-27-2006 at 10:11 AM.
    Andy Reed
    RHCE and CCNA
    ServerTune.com

  7. #7
    Member
    Join Date
    Jul 2003
    Posts
    26

    Unhappy

    Quote Originally Posted by AndyReed
    change the root password for MySQL
    Code:
    Mysql password change failed!!
    A forced reset will now be attempted.
    
    Waiting for mysql to restart.....Done
    Changing Password..../usr/sbin/mysqld: ready for connections.
    Version: '4.1.14-standard'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Edition - Standard (GPL)
    Done
    Reloading Mysqld...
    Done
    Waiting for mysql to terminate.....
    
    Restarting MySQL ....Starting MySQL...................................[FAILED] Done
    
    The MySQL root password has been changed.
    Quote Originally Posted by AndyReed
    ps aux |grep mysql
    Code:
    root     22376  0.0  0.1  3688  668 pts/0    S    10:12   0:00 grep mysql
    Quote Originally Posted by AndyReed
    killall -9 mysql
    Code:
    mysql: no process killed
    Quote Originally Posted by AndyReed
    /scripts/restartv mysql
    Code:
    -bash: /scripts/restartv: No such file or directory
    So I used
    Code:
    /etc/init.d/mysql restart
    and it returned
    Code:
    MySQL PID file could not be found!                         [FAILED]
    Starting MySQL...................................          [FAILED]
    Quote Originally Posted by AndyReed
    Check on errors:
    tail -f /var/log/mysqld.log
    Code:
    tail: /var/log/mysqld.log: No such file or directory
    tail: no files remaining
    Quote Originally Posted by AndyReed
    If that doesn't work, try this command:
    /scripts/mysqlup --force
    Code:
    /usr/bin/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!
    mysql has failed, please contact the sysadmin (result was "Warning, no valid mysql.sock file found.mysql has failed").
    Install Complete
    Quote Originally Posted by AndyReed
    If that doesn't work, I suggest you hire a sys admin to fix this problem for you.
    Looks like I might have to

    Thanks for trying to help I can't think of anything else to try now

  8. #8
    Member
    Join Date
    Mar 2003
    Location
    Canada
    Posts
    217

    Default

    try this

    1) edit the /etc/my.cnf file and put this under the section
    Code:
    [mysqld]
    socket = /var/lib/mysql/mysql.sock
    2) Then stop it then restart and see if that helps
    Affordable Linux Server Managament Solution
    http://www.linuxnetworkcare.com/services/cpanel.php
    [ Phone: 647-722-5303 MSN : sutha@linuxnetworkcare.com AIM : xerophytev skype:ksutha5]

  9. #9
    Member
    Join Date
    Jan 2005
    Location
    Earth
    Posts
    1,050

    Default

    Quote Originally Posted by dempsey
    I know there are already loads of threads about MySQL.Sock errors, but I have read through all of the ones I could find and none of them helped me.

    I have just restored my server from the old HD and everything seems to be working now apart from MySQL, giving me the error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

    I can't seem to find a myqsl.sock file anywhere, I looked in /tmp, /var/tmp, /var/lib/mysql.

    I have tried /scripts/fixmysql and that doesn't help, nor does /scripts/mysqlup --force

    Is there anyway to recreate a mysql.sock file? Is it just a text file with some data in?

    Anyone have any ideas on something to try?

    Thanks for any replies
    See if this helps you :- http://forums.cpanel.net/showthread.php?t=48890

  10. #10
    cPanel Partner NOC cPanel Partner NOC Badge jester.ro's Avatar
    Join Date
    Feb 2004
    Location
    Bucharest, Romania
    Posts
    304

    Default

    hmm, i just had this happening on a newly installed server, and i thought i made a mistake while setting up and screwed it.

    nothing worked. i tried setting pid and sock directly in my.cnf, i changed the name of the pid in /etc/init.d/mysql ...nada

    even switched versions, from 4.0 to 4.1, and back.


    finally i gave up and did a yum remove MySQL*
    deleted the /var/lib/mysql dir and my.cnf and ran /scripts/mysqlup (after setting the desired mysql version in whm tweak settings). It worked.

    This was a newly installed centos 4.2 server. Make sure u don;t loose valuable databases when deleting var/lib/mysql.

  11. #11
    Member
    Join Date
    Jul 2003
    Posts
    26

    Default

    Well I think MySQL is up and running now, not sure what they did, but got someone to have a look for me, thank you to everyone for your replies

  12. #12
    Member
    Join Date
    Aug 2003
    Posts
    11

    Default

    Hi,

    Same problem here.

    New clean install on CentOs 4.2. I solved the problem removing mysql and installing again with /scripts/mysqlup.

  13. #13
    Member duranduran's Avatar
    Join Date
    Apr 2004
    Posts
    198

    Arrow Fix

    Try This:

    myisamchk -s /var/lib/mysql/db.MYI

    If you see any erros, execute:

    myisamchk -r /var/lib/mysql/db.MYI

    and

    myisamchk -o /var/lib/mysql/db.MYI

    Now service mysql restart

Similar Threads & Tags
Similar threads

  1. MySQL fails - /tmp/mysql.sock error
    By mudduck in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 11-16-2007, 10:28 AM
  2. Can't get mysql to work - Getting mysql.sock error (but a unique one)
    By noimad1 in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 10-21-2006, 02:04 AM
  3. Help me please,mysql sock error
    By esthost in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 03-07-2006, 10:57 AM
  4. mysql sock error - don't see this specifically in other threads
    By drhamad in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 02-12-2006, 01:15 PM
  5. MySQL Sock Error
    By Mini in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 02-11-2006, 04:36 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube