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 problem

Discussion in 'General Discussion' started by dan223, Jul 8, 2007.

  1. dan223

    dan223 Well-Known Member

    Joined:
    Mar 31, 2006
    Messages:
    74
    Likes Received:
    0
    Trophy Points:
    6
    Hi i keep getting the 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!

    I have tried force for mysql and cpanel update but get the same error
    Please help!
     
  2. ManojB

    ManojB Well-Known Member

    Joined:
    Mar 25, 2005
    Messages:
    80
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    pune
    Login to WHM as root and restart MySQL, if you still face the same problem then change mysql root password from the WHM (WHM > SQL Services > MySQL Root Password).
     
  3. dan223

    dan223 Well-Known Member

    Joined:
    Mar 31, 2006
    Messages:
    74
    Likes Received:
    0
    Trophy Points:
    6
    When restarting I get:

    /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").

    When changing cpanel password:

    Waiting for mysql to restart...../usr/sbin/mysqld: ready for connections.
    Version: '4.1.21-standard' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Edition - Standard (GPL)
    This script updates all the mysql privilege tables to be usable by
    MySQL 4.0 and above.

    This is needed if you want to use the new GRANT functions,
    CREATE AGGREGATE FUNCTION, or the more secure passwords in 4.1

    done
    Done
    Changing Password....Done
    Reloading Mysqld...
    Done
    Waiting for mysql to terminate.....

    Restarting MySQL ....Starting MySQL................................... ERROR! Done

    The MySQL root password has been changed.
     
  4. jayh38

    jayh38 Well-Known Member

    Joined:
    Mar 3, 2006
    Messages:
    1,215
    Likes Received:
    0
    Trophy Points:
    36
    Paste your mysql.cnf contents.

    If you have this in your cnf, try commenting it out:
    basedir=/var/lib
     
  5. dan223

    dan223 Well-Known Member

    Joined:
    Mar 31, 2006
    Messages:
    74
    Likes Received:
    0
    Trophy Points:
    6
    I gather you mean my.cnf, I have pasted it below, that is the full file.

    [mysqld]
    set-variable = max_connections=500
    safe-show-database
     
  6. dan223

    dan223 Well-Known Member

    Joined:
    Mar 31, 2006
    Messages:
    74
    Likes Received:
    0
    Trophy Points:
    6
    The actual file /var/lib/mysql/mysql.sock doesn't exist
     
  7. jayh38

    jayh38 Well-Known Member

    Joined:
    Mar 3, 2006
    Messages:
    1,215
    Likes Received:
    0
    Trophy Points:
    36
    Yes I meant my.cnf, lol.. ok you will need to create the socket then and link it to tmp.

    cd /var/lib/mysql
    touch mysql.sock
    chown mysql:mysql mysql.sock
    chmod 1777 mysql.sock
    ln -s /var/lib/mysql/mysql.sock /tmp
    chmod 1777 /tmp
    /scripts/mysqlup --force
    /etc/rc.d/init.d/mysql restart


    did you recently change versions?
     
  8. dan223

    dan223 Well-Known Member

    Joined:
    Mar 31, 2006
    Messages:
    74
    Likes Received:
    0
    Trophy Points:
    6
    done that still not working, i get the below error when running the force commands

    070708 21:12:04 [ERROR] /usr/sbin/mysqld: Can't find file: './mysql/help_relation.frm' (errno: 13)

    The socket file then disappears at the end

    Going to read /home/.cpan/Metadata
    /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!
    Unable to reset root MySQL password. at /scripts/securemysql line 154.
     
  9. dan223

    dan223 Well-Known Member

    Joined:
    Mar 31, 2006
    Messages:
    74
    Likes Received:
    0
    Trophy Points:
    6
    In a log I found:

    070708 21:12:05 mysqld started
    070708 21:12:06 InnoDB: Started; log sequence number 0 49367
    070708 21:12:06 [ERROR] /usr/sbin/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
    070708 21:12:06 [ERROR] /usr/sbin/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
    070708 21:12:06 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)
    070708 21:12:06 mysqld ended

    070708 21:16:11 mysqld started
    070708 21:16:12 InnoDB: Started; log sequence number 0 49367
    070708 21:16:12 [ERROR] /usr/sbin/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
    070708 21:16:12 [ERROR] /usr/sbin/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
    070708 21:16:12 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)
    070708 21:16:12 mysqld ended

    070708 21:17:20 mysqld started
    070708 21:17:21 InnoDB: Started; log sequence number 0 49367
    070708 21:17:21 [ERROR] /usr/sbin/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
    070708 21:17:21 [ERROR] /usr/sbin/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
    070708 21:17:21 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)
    070708 21:17:21 mysqld ended
     
  10. jayh38

    jayh38 Well-Known Member

    Joined:
    Mar 3, 2006
    Messages:
    1,215
    Likes Received:
    0
    Trophy Points:
    36
    Add this to your my.cnf

    datadir=/var/lib/mysql
    skip-locking
    skip-innodb

    Check over your file permissions. You could very well have a corrupt innodb table also. Then try recreating your socket again.
     
  11. dan223

    dan223 Well-Known Member

    Joined:
    Mar 31, 2006
    Messages:
    74
    Likes Received:
    0
    Trophy Points:
    6
    Ok still no luck,

    I ran this:

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

    And still doesn't work, it all started not long after i did the commands above.
     
  12. dan223

    dan223 Well-Known Member

    Joined:
    Mar 31, 2006
    Messages:
    74
    Likes Received:
    0
    Trophy Points:
    6
    Could someone help :(
     
  13. dan223

    dan223 Well-Known Member

    Joined:
    Mar 31, 2006
    Messages:
    74
    Likes Received:
    0
    Trophy Points:
    6
    Now getting the problem:

    070709 09:20:14 mysqld started
    070709 9:20:15 [ERROR] Can't start server : Bind on unix socket: Permission denied
    070709 9:20:15 [ERROR] Do you already have another mysqld server running on socket: /var/lib/mysql/mysql.sock ?
    070709 9:20:15 [ERROR] Aborting

    070709 9:20:15 [Note] /usr/sbin/mysqld: Shutdown complete

    070709 09:20:15 mysqld ended
     
  14. jayh38

    jayh38 Well-Known Member

    Joined:
    Mar 3, 2006
    Messages:
    1,215
    Likes Received:
    0
    Trophy Points:
    36
    Ok, try deleting the mysql.sock in /tmp since it sounds like its trying to create the socket but it already exists.

    Also again, double check your file / folder permissions if you still have no luck. You have a permission error as indicated in your previous post.

    Also I am wondering, do you have selinux enabled? If so, disable that.
    /etc/selinux/config

    SELINUX=disabled
     
    #14 jayh38, Jul 9, 2007
    Last edited: Jul 9, 2007
  15. dan223

    dan223 Well-Known Member

    Joined:
    Mar 31, 2006
    Messages:
    74
    Likes Received:
    0
    Trophy Points:
    6
    Hi,
    Found sock, deleted sock started service, it made a new sock in temp, and same error
    Couldn't find /etc/selinux/config (this is a VPS) and I have ran

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

    Otherwise how can I fix the permission problem
     
    #15 dan223, Jul 9, 2007
    Last edited: Jul 9, 2007
  16. jayh38

    jayh38 Well-Known Member

    Joined:
    Mar 3, 2006
    Messages:
    1,215
    Likes Received:
    0
    Trophy Points:
    36
    I didn't realize this was a vps. I would suggest contacting your provider as they may have mysql running on your account from the node side which may conflict with cpanel. This may happen if you are on virtuozzo.
     
  17. dan223

    dan223 Well-Known Member

    Joined:
    Mar 31, 2006
    Messages:
    74
    Likes Received:
    0
    Trophy Points:
    6
    I am the provider :P So I have node access. There are other cpanel mysqls running on other vps's fine.

    I am running openvz and the server provider are looking into it, but they normally are not very good.
     
  18. dan223

    dan223 Well-Known Member

    Joined:
    Mar 31, 2006
    Messages:
    74
    Likes Received:
    0
    Trophy Points:
    6
    I was wondering if you or anyone has anymore ideas about the issue, it would be greatly appreciated.
     
  19. madaboutlinux

    madaboutlinux Well-Known Member

    Joined:
    Jan 24, 2005
    Messages:
    1,052
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Earth
    Go through these steps again:

    cd /var/lib/mysql
    touch mysql.sock
    chown mysql.mysql mysql.sock
    chmod 2777 mysql.sock

    Also check whether the sym link is created in /tmp else
    ln -s /var/lib/mysql/mysql.sock /tmp

    Edit /etc/my.cnf file and add the line as
    socket=/var/lib/mysql/mysql.sock

    and restart mysql. See if this helps.
     
  20. dan223

    dan223 Well-Known Member

    Joined:
    Mar 31, 2006
    Messages:
    74
    Likes Received:
    0
    Trophy Points:
    6
    Hi, my server company fixed the problem below is what they said:

    There were some packages missing in mysql causing it to not start properly. We
    have reinstalled mysql in your server
     
Loading...

Share This Page