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.

2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock (2)

Discussion in 'General Discussion' started by poops, May 22, 2006.

  1. poops

    poops Member

    Joined:
    May 6, 2006
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    1
    Those who face error
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
    it is not the error bcoz when mysql deamon starts it 1st checks the /tmp/mysql.sock
    if /tmp permission changes to other than 777 then the above error comes
    i've faced the same error
    when i checked /var/lib/mysql/ for mysql.sock it didn't found there it never happens when it is not found but if not found then try to create uor self command is

    cd /var/lib/mysql
    touch mysql.sock
    chown mysql:mysql mysql.sock
    chmod 1777 mysql.sock

    now make a sym link into /tmp

    ln -s /var/lib/mysql/mysql.sock /tmp
    then
    chmod 1777 /tmp

    now
    /scripts/mysqlup --force


    now just restart mysql
    /etc/rc.d/init.d/mysql restart

    ----------------------------------------------------------:D
    in the end would like to thanx Mr Sheakhar
     
  2. k1k

    k1k Active Member

    Joined:
    Mar 24, 2006
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    :)

    The sockets are create from the mysql service. You should remove the files created from you.
    Now you have to check your permissions. Here what I can give you as procedure:


    1. chown -R mysql.mysql /var/lib/mysql
    2. chmod 777 /tmp
    3. chmod 777 /var/tmp
    4. su mysql
    5. killall -s KILL mysqld
    6. mysqld

    Now you will see the Mysql Service starting process. If it is successfull then you can restart it as root(/etc/init.d/mysql restart or /scripts/restartsrv_mysql).
     
  3. djblamire

    djblamire Well-Known Member

    Joined:
    May 3, 2003
    Messages:
    250
    Likes Received:
    0
    Trophy Points:
    16
    OK, Doing this did seem to work when I started 'mysqld' as 'mysql'. Although I got the error:

    bash-3.00$ mysqld
    060524 8:18:36 InnoDB: Started
    060524 8:18:36 mysqld: Can't open file: 'columns_priv.MYI'. (errno: 130)
    mysqld: ready for connections.
    Version: '4.0.26-standard' socket: '/var/lib/mysql/mysql.sock' port: 3306 Official MySQL RPM

    When I logged back in as root and tried to restart, that stopped it working again.

    Any ideas ?

    Thanks
    Daniel
     
  4. monsterhosting

    monsterhosting Active Member

    Joined:
    Feb 12, 2004
    Messages:
    39
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Vancouver, BC
    Upgrading to 4.1.x fixes the issue immediately.
     
  5. OleOldhoj

    OleOldhoj Member

    Joined:
    May 24, 2006
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    "help!"

    Ok


    have the same problem - all sites gives the fault that they cant connect to the database

    I when I look in their cpanel - I can see no mySQL database
    I have updatet the "Main >> Software >> Apache Update"

    but dont have any idea that else to do "HELP!"
     
  6. monsterhosting

    monsterhosting Active Member

    Joined:
    Feb 12, 2004
    Messages:
    39
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Vancouver, BC
    You need to go to tweak settings choose MySQL 4.1, check off 4.0 old passwords so that all your scripts don't stop working and click done.

    Login in to SSH as root and do:

    /scripts/mysqlup --force

    Once it is done clean up by doing a:

    /etc/init.d/mysql restart
    /etc/init.d/cpanel restart
    /etc/init.d/chkservd restart
     
  7. OleOldhoj

    OleOldhoj Member

    Joined:
    May 24, 2006
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Tried that

    and gets a fault -

    Adding new fields used by MySQL 4.0.2 to the privilege tables
    You can ignore any Duplicate column errors
    ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/m
    ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/m
    ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/m
    ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/m
    Waiting for mysql to restart..............finished.


    /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").
    /usr/sbin/setfiles: labeling files under /

    --------------------
    and
    --------------------


    /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").
    /usr/sbin/setfiles: labeling files under /
    matchpathcon_filespec_eval: hash table stats: 1 elements, 1/65536 buckets used, longest chain length 1
    /usr/sbin/setfiles: Done.
    Install Complete
    root@EvaDuarde [/var/lib/mysql/mysql]#

    -----
    and again i dont have MYQSL databases on the accounts

    they show

    Addon Domains 0 / 2048
    MySQL Databases / 2048 <------
    Postgresql Databases 1 / 2048

    ---- bye the way

    root@EvaDuarde [/var/lib/mysql/mysql]# cat /etc/my.cnf
    cat: /etc/my.cnf: No such file or directory
    root@EvaDuarde [/var/lib/mysql/mysql]#


    I dont have a my.cnf


    You are welcome to contact me on MSN (Oldhoj@hotmail.com ) or ICQ 144798790
    I really need a soloution
     
    #7 OleOldhoj, May 24, 2006
    Last edited: May 24, 2006
  8. djblamire

    djblamire Well-Known Member

    Joined:
    May 3, 2003
    Messages:
    250
    Likes Received:
    0
    Trophy Points:
    16
    This worked for me!!

    Thank you VERY much,

    Daniel
     
  9. monsterhosting

    monsterhosting Active Member

    Joined:
    Feb 12, 2004
    Messages:
    39
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Vancouver, BC
    It looks from this that you did not change it to 4.1.x instead it is trying to use 4.0.x. Login to WHM and adjust that in your Tweak Settings.
     
    #9 monsterhosting, May 24, 2006
    Last edited: May 24, 2006
  10. hamper

    hamper Well-Known Member

    Joined:
    Apr 28, 2006
    Messages:
    85
    Likes Received:
    0
    Trophy Points:
    6
    mine is doing the exact same thing.

    which radio do I use, the top or middle? and yes, I have the box checked to keep the passwords the same.
     
  11. monsterhosting

    monsterhosting Active Member

    Joined:
    Feb 12, 2004
    Messages:
    39
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Vancouver, BC
    I am going to guess you mean in the Tweak Settings. It's the middle one (or the one above the Password option).
     
  12. kdarray

    kdarray Well-Known Member

    Joined:
    Apr 13, 2006
    Messages:
    81
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Washington
    cannot get sql to restart-all sites down

    i have been through the forum and tried most of the options people have mentioned. the server is WHM 10.8.0 cPanel 10.8.1-S114, Fedora i686 - WHM X v3.1.0 (Fedora 4) and mysql v.4.0.25. mysql stopped after upcp ran this morning, though i can't see that it changed anything.

    i can't get into phpadmin either. getting wrong username and password error. so this and no mysql.

    i have tried these and know there have been numerous problems with this in the past week. my servers are set to manual updates

    1. chown -R mysql.mysql /var/lib/mysql
    2. chmod 777 /tmp
    3. chmod 777 /var/tmp
    4. su mysql
    5. killall -s KILL mysqld
    6. mysqld

    and this:
    cd /var/lib/mysql
    touch mysql.sock
    chown mysql:mysql mysql.sock
    chmod 1777 mysql.sock

    ln -s /var/lib/mysql/mysql.sock /tmp
    then
    chmod 1777 /tmp

    /scripts/mysqlup --force

    /etc/rc.d/init.d/mysql restart

    still getting ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2). mysql.sock just disappears right after chmod or creating the symlink.

    also myphpadmin i get wrong username and password, though it is correct in my.cnf and i have changed the root password and tried that as well.

    cannot get mysql to restart and urgently need help. all sites on this server are down and not a pleasant sunday morning here.
     
  13. Saloni

    Saloni Active Member

    Joined:
    May 26, 2006
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    Please check the permission for /tmp folder

    It should be chmod'ed to 1777
     
  14. Johnpg82

    Johnpg82 Member

    Joined:
    Jul 3, 2005
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    I am having the same problem and I have tried everything in this thread. The mysql.sock was not there before and is now there but it still says

    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysq l.sock' (111)

    Thanks, John.
     
  15. AndyReed

    AndyReed Well-Known Member
    PartnerNOC

    Joined:
    May 29, 2004
    Messages:
    2,222
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Minneapolis, MN
    Are you sure MySQL is installed properly on your server? If you tried every thing in this thread and didn't work, I suggest you seek professional help.
     
  16. sumith

    sumith Well-Known Member

    Joined:
    May 9, 2005
    Messages:
    96
    Likes Received:
    2
    Trophy Points:
    8
    Paste the contents of your /etc/my.cnf file , syntax error in my.cnf can cause mysql stop working
     
  17. claudio

    claudio Well-Known Member

    Joined:
    Jul 31, 2004
    Messages:
    201
    Likes Received:
    0
    Trophy Points:
    16
    have you tried /scripts/./restartsrv_mysql
    ?
     

Share This Page