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.

[Case 105565] recreate /tmp/mysql.sock on mysql restart

Discussion in 'cPanel Developers' started by simonas, Jun 24, 2014.

  1. simonas

    simonas Well-Known Member

    Joined:
    Apr 21, 2013
    Messages:
    141
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Lithuania
    cPanel Access Level:
    Root Administrator
    Hello everybody,

    With the latest update (Cpanel version: 11.44.0 (build 17)) one of my server's began having problem - system could not connect to the mysql.

    Code:
    Cron <root@host> /usr/bin/test -x /usr/local/cpanel/scripts/update_db_cache && /usr/local/cpanel/scripts/update_db_cache
    
    Error while connecting to MySQL: Cpanel::DBI::Mysql connect('','root',...) failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) at /usr/local/cpanel/Cpanel/Mysql.pm line 140
    Also MODSEC:

    Code:
    /etc/cron.hourly/modsecparse.pl:
    
    DBI connect('modsec:localhost','modsec',...) failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) at /etc/cron.hourly/modsecparse.pl line 20
    Unable to connect to mysql database at /etc/cron.hourly/modsecparse.pl line 20.
    After investigating with the help of Cpanel, we found that
    And openened inquiry (#105565).

    Quick solution would be add to you /etc/my.cnf:
    Or create symlink. Mods, please update this thread. Thanks.
     
    #1 simonas, Jun 24, 2014
    Last edited: Jun 24, 2014
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    653
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    Internal case number 105565 is open to inquire if /tmp/mysql.sock should be recreated after MySQL restarts. I will update this thread with more information as it becomes available. In the meantime, manually creating the symbolic link is a valid workaround if it does not exist:

    Code:
    ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock 
    Thank you.
     
  3. jayrex

    jayrex Registered

    Joined:
    Jul 6, 2014
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I believe I have the same type of problem:

    Error while connecting to MySQL: Cpanel::DBI::Mysql connect('','root',...) failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) at /usr/local/cpanel/Cpanel/Mysql.pm line 140 Error while connecting to MySQL: Cpanel::DBI::Mysql connect('','root',...) failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) at /usr/local/cpanel/Cpanel/Mysql.pm line 140 ...caught

    Could someone let me know if this can be fixed?

    I won't be able to fix this myself as I'm not technical, but it looks like an automatic update created this error, will cPanel bring out another update to fix this error?
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    653
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator

Share This Page