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 socket errors why ?

Discussion in 'General Discussion' started by hicom, May 17, 2005.

  1. hicom

    hicom Well-Known Member

    Joined:
    May 23, 2003
    Messages:
    272
    Likes Received:
    0
    Trophy Points:
    16
    We have somewhat busy mySQL server, and every now and then when we restart the mySQL database using WHM receive the error:

    /usr/local/bin/mysqladmin: connect to server at 'localhost' failed error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)' Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists! mysql has failed, please contact the sysadmin (result was "Warning, no valid mysql.sock file found.mysql has failed").

    When we restart again, it works fine:

    root 80040 0.0 0.0 648 280 ?? S 12:45AM 0:00.01 /bin/sh /usr/local/bin/mysqld_safe --user=mysql

    mysql 80060 1.0 1.0 51604 20668 ?? S 12:45AM 0:00.22 /usr/local/libexec/mysqld --basedir=/usr/local --datadir=/var/db/mysql --user=mysql --pid-file=/var/db/mysql/impala.smallvillages.com.pid --socket=/tmp/mysql.sock

    However, the mysql.sock does always exist there. Sometimes when cPanel update late at night, mySQL for some reason stops responding at all. The cPanel cpsrvd service does not detect mySQL is not responding (mySQL is still running, but it is not connecting to the socket, while the socket is there).

    We're using mySQL 4.0.24 with the latest stable cPanel 10 on FreeBSD 4.10

    what could be causing this problem ? as you see from above, I specified the socket= in my.cnf but that still did not resolve the problem.
     
  2. bijo

    bijo Well-Known Member

    Joined:
    Aug 21, 2004
    Messages:
    475
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    India
    Run the mount command and paste the result here. May be your /tmp partition mount to another folder like /var/tmp. Then stop the mysql and unmount the partition. Then start the mysql service again. May be it will help you to solve your problem.

    Could you please update the status?.
     
    #2 bijo, May 18, 2005
    Last edited: May 18, 2005
  3. hicom

    hicom Well-Known Member

    Joined:
    May 23, 2003
    Messages:
    272
    Likes Received:
    0
    Trophy Points:
    16
    tmp is mounted locally to its own partition:

    /tmp on tmp (null, local)

    I have /var/tmp linked to /tmp

    and the socket option is specified as:

    socket=/tmp/mysql.sock

    so it has no relation with /var/tmp.

    Maybe cPanel restart script is not terminating properly when the mySQL is very busy, or it is not giving it enough time to delete the mysql.sock ?!

    This happens frequently, but not always. Another reason why it is very hard to diagnose.
     
  4. Radio_Head

    Radio_Head Well-Known Member

    Joined:
    Feb 15, 2002
    Messages:
    2,051
    Likes Received:
    1
    Trophy Points:
    38
    same problem here
     
  5. hicom

    hicom Well-Known Member

    Joined:
    May 23, 2003
    Messages:
    272
    Likes Received:
    0
    Trophy Points:
    16
    This is what I found in the log when this happens:

    050620 10:34:52 /usr/local/libexec/mysqld: Normal shutdown

    050620 10:34:52 mysqld restarted
    050620 10:34:54 mysqld started
    050620 10:34:54 Can't start server: Bind on TCP/IP port: Address already in use
    050620 10:34:54 Do you already have another mysqld server running on port: 3306 ?
    050620 10:34:54 Aborting

    050620 10:34:54 /usr/local/libexec/mysqld: Shutdown Complete

    050620 10:34:55 mysqld ended

    050620 10:34:55 InnoDB: Database was not shut down normally.
    InnoDB: Starting recovery from log files...
    InnoDB: Starting log scan based on checkpoint at
    InnoDB: log sequence number 0 89849
    InnoDB: Doing recovery: scanned up to log sequence number 0 89849
    050620 10:34:55 InnoDB: Flushing modified pages from the buffer pool...
    050620 10:34:55 InnoDB: Started
    /usr/local/libexec/mysqld: ready for connections.
    Version: '4.0.24-log' socket: '/tmp/mysql.sock' port: 3306 FreeBSD port: mysql-server-4.0.24
    050620 10:35:12 /usr/local/libexec/mysqld: Normal shutdown

    050620 10:35:12 InnoDB: Starting shutdown...
    050620 10:35:13 mysqld started
    050620 10:35:14 InnoDB: Database was not shut down normally.
    InnoDB: Starting recovery from log files...
    InnoDB: Starting log scan based on checkpoint at
    InnoDB: log sequence number 0 89849
    InnoDB: Doing recovery: scanned up to log sequence number 0 89849
    050620 10:35:14 InnoDB: Flushing modified pages from the buffer pool...
    050620 10:35:14 InnoDB: Started
    /usr/local/libexec/mysqld: ready for connections.


    As you'll notice I had to try and restart the mySQL service couple of time until it worked. But the initial problem as indicated above:

    '050620 10:34:54 Can't start server: Bind on TCP/IP port: Address already in use'

    any suggestions?

    Thx
     
  6. bijo

    bijo Well-Known Member

    Joined:
    Aug 21, 2004
    Messages:
    475
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    India
    Hello,

    This show that your port is used by any other program or mysql. First stop the chkservd and mysql service and run the following command

    -----------------------------
    ps -aux | grep mysql
    ----------------------------
    if it shows any mysql connection use the following command
    ----------------
    killall -9 mysql
    ----------------
    And then run the previous command again. If you get no status, try to start mysql and check the log. Also you can check the port by using the following command
    --------------------------------------------
    nmap -sS localhost
    --------------------------------------------

    May be this will help you to trouble shoot your issue.
    Let me know the status ;)
     
    #6 bijo, Jun 21, 2005
    Last edited: Jun 21, 2005
Loading...

Share This Page