The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

MySQL Sock Error - Existing threads no help

Discussion in 'General Discussion' started by dempsey, Jan 26, 2006.

  1. dempsey

    dempsey Active Member

    Joined:
    Jul 17, 2003
    Messages:
    26
    Likes Received:
    0
    Trophy Points:
    1
    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. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    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
     
  3. dempsey

    dempsey Active Member

    Joined:
    Jul 17, 2003
    Messages:
    26
    Likes Received:
    0
    Trophy Points:
    1
    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. :confused:

    Any other ideas?
     
  4. AndyReed

    AndyReed Well-Known Member
    PartnerNOC

    Joined:
    May 29, 2004
    Messages:
    2,222
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Minneapolis, MN
    That's very odd. Are you sure MySQL is installed, or installed properly, on the new server?
     
  5. dempsey

    dempsey Active Member

    Joined:
    Jul 17, 2003
    Messages:
    26
    Likes Received:
    0
    Trophy Points:
    1
    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. AndyReed

    AndyReed Well-Known Member
    PartnerNOC

    Joined:
    May 29, 2004
    Messages:
    2,222
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Minneapolis, MN
    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.
     
    #6 AndyReed, Jan 27, 2006
    Last edited: Jan 27, 2006
  7. dempsey

    dempsey Active Member

    Joined:
    Jul 17, 2003
    Messages:
    26
    Likes Received:
    0
    Trophy Points:
    1
    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.
    Code:
    root     22376  0.0  0.1  3688  668 pts/0    S    10:12   0:00 grep mysql
    Code:
    mysql: no process killed
    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!                         [[COLOR=Red]FAILED[/COLOR]]
    Starting MySQL...................................          [[COLOR=Red]FAILED[/COLOR]]
    
    Code:
    tail: /var/log/mysqld.log: No such file or directory
    tail: no files remaining
    
    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
    
    Looks like I might have to :(

    Thanks for trying to help :) I can't think of anything else to try now :(
     
  8. xerophyte

    xerophyte Well-Known Member

    Joined:
    Mar 16, 2003
    Messages:
    216
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Canada
    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
     
  9. madaboutlinux

    madaboutlinux Well-Known Member

    Joined:
    Jan 24, 2005
    Messages:
    1,052
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Earth
    See if this helps you :- http://forums.cpanel.net/showthread.php?t=48890
     
  10. jester.ro

    jester.ro Well-Known Member
    PartnerNOC

    Joined:
    Feb 6, 2004
    Messages:
    304
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Bucharest, Romania
    cPanel Access Level:
    DataCenter Provider
    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. dempsey

    dempsey Active Member

    Joined:
    Jul 17, 2003
    Messages:
    26
    Likes Received:
    0
    Trophy Points:
    1
    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 :D
     
  12. Tiago

    Tiago Member

    Joined:
    Aug 22, 2003
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    Same problem here.

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

    duranduran Well-Known Member

    Joined:
    Apr 30, 2004
    Messages:
    198
    Likes Received:
    0
    Trophy Points:
    16
    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
     
Loading...

Share This Page