Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2009
    Posts
    104
    Plugin Contributions
    0

    Default mysqli_connect fails through socket '/var/lib/mysql/mysql.sock'

    I just recently upgraded to 1.5.3 and now I'm getting a lot of these logs. 90% of the time everything seems to work then "Sorry the site is down for Maint.".

    [09-Dec-2014 07:55:03 America/New_York] PHP Warning: mysqli_connect(): (HY000/2002): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in includes/classes/db/mysql/query_factory.php on line 62

    60 while (!isset($this->link) || ($this->link == FALSE && $connectionRetry !=0) )
    61 {
    62 $this->link = mysqli_connect($zf_host, $zf_user, $zf_password);
    63 $connectionRetry--;
    64 }

    Thoughts.
    Thanks

  2. #2
    Join Date
    Feb 2012
    Location
    mostly harmless
    Posts
    1,809
    Plugin Contributions
    8

    Default Re: mysqli_connect fails

    ... through socket '/var/lib/mysql/mysql.sock' (2) in includes/classes/db/mysql/query_factory.php on line 62 ...
    This indicates your website has PHP configured to connect to MySQL using the specified UNIX socket. Error number 2 usually indicates the socket does not exist (or PHP does not have access to the socket).

    Would recommend contacting your hosting provider to resolve the issue.

    Alternatively if you know the settings required by your hosting provider to connect to MySQL (such as host / port -- or -- host / socket) and have access to php.ini you can update the MySQL related section in php.ini (to use the correct port or socket by default).
    The glass is not half full. The glass is not half empty. The glass is simply too big!
    Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
    Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

  3. #3
    Join Date
    Jul 2009
    Posts
    104
    Plugin Contributions
    0

    Default Re: mysqli_connect fails

    From my hosting company:
    The interesting thing is, it's the only database table this is happening to, none of your other ones have shown the same problem in the logs.

    However there are times when I run mysqlcheck I get Failed to Connect. And I have a daily script
    for db in "show databases (returns 10)" (pseudo code)
    do
    mysqlcheck db
    done

    I get several lines on different DBs: "warning 3 clients are using or haven't closed the table properly"
    even on a db/table that is not in use. It makes me wonder if another user/hacker is over connecting. My problem with checking for that is all users are "jailed" so I can't do top,ps,who,etc. Which doesn't mean some 14 yo russian kid isn't scanning my DB's for data or that another user has a webpage w DB that's hammering the L out of things. Also when I pull up a given webpage, uses mysql, and get "Woops. Can't connect". So I reload the page and it works.

    Anything/argument/direction I can give my hosting company?

    Thanks
    cal

  4. #4
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: mysqli_connect fails

    Quote Originally Posted by liderbug View Post
    From my hosting company:
    The interesting thing is, it's the only database table this is happening to, none of your other ones have shown the same problem in the logs.
    You must have given your hosting company different information than you have given us. Either that, or they are feeding you BS, because the log entry provided doesn't indicate which table is being accessed, therefore they can't possibly say its the only one.

    Besides that, the error log provided clearly show that it is an issue connecting to the *database* and until it an do this it has no way of accessing ANY of the *tables*.

    Quote Originally Posted by liderbug View Post
    However there are times when I run mysqlcheck I get Failed to Connect. And I have a daily script
    for db in "show databases (returns 10)" (pseudo code)
    do
    mysqlcheck db
    done
    Who is "I" in this case? You or someone from the hosting company?

    Quote Originally Posted by liderbug View Post
    I get several lines on different DBs: "warning 3 clients are using or haven't closed the table properly"
    even on a db/table that is not in use.
    Nothing particularly unusual here. There are many possible causes. eg: Client gone away, code not correctly closing the tables after use, Server overloaded.

    Quote Originally Posted by liderbug View Post
    It makes me wonder if another user/hacker is over connecting.
    Do you have a reason for thinking this? What?

    Quote Originally Posted by liderbug View Post
    My problem with checking for that is all users are "jailed" so I can't do top,ps,who,etc.
    Nothing unusual here.

    Quote Originally Posted by liderbug View Post
    Which doesn't mean some 14 yo russian kid isn't scanning my DB's for data
    It does mean that if the server doesn't allow remote access, and MANY don't. Thanks to a Nasty Miscrosoft bug *many* years a ago many hosts consider this as too much of a security risk (something that I don't agree with, its more secure than FTP, which all hosts seem to allow without a seconf thought).

    Quote Originally Posted by liderbug View Post
    or that another user has a webpage w DB that's hammering the L out of things.
    Or perhaps even a search engine (if the host isn't up to handling the traffic).

    Quote Originally Posted by liderbug View Post
    Also when I pull up a given webpage, uses mysql, and get "Woops. Can't connect". So I reload the page and it works.
    Sound to me like the MySQL server can't handle what is being asked of it.

    Quote Originally Posted by liderbug View Post
    Anything/argument/direction I can give my hosting company?

    Thanks
    cal
    It isn't for you (or me) to give a hosting company any direction or argument. They will have logs to indicate these server errors and it is really up to them to find the cause and solution. All you can really do is try to keep track of when it occurs and keep submitting fault reports.

    Cheers
    RodG

  5. #5
    Join Date
    Jul 2009
    Posts
    104
    Plugin Contributions
    0

    Default Re: mysqli_connect fails

    First... WOW. Quite the reply. thanks

    Quote Originally Posted by RodG View Post
    You must have given your hosting company different information than you have given us. Either that, or they are feeding you BS, because the log entry provided doesn't indicate which table is being accessed, therefore they can't possibly say its the only one.

    I've given them several things - I started with the connect-fail entry and have through several email tried to explain things I've tried - to help find the problem.

    Besides that, the error log provided clearly show that it is an issue connecting to the *database* and until it an do this it has no way of accessing ANY of the *tables*.



    Who is "I" in this case? You or someone from the hosting company?

    I = me



    Nothing particularly unusual here. There are many possible causes. eg: Client gone away, code not correctly closing the tables after use, Server overloaded.

    Well one thing - one of the tables (pizza) complains that a table wasn't closed. But "pizza" is a test DB and is only used by me from the command line and the last time .... was ... 6 months ago???



    Do you have a reason for thinking this? What?

    See the above comment

    Nothing unusual here.



    It does mean that if the server doesn't allow remote access, and MANY don't. Thanks to a Nasty Miscrosoft bug *many* years a ago many hosts consider this as too much of a security risk (something that I don't agree with, its more secure than FTP, which all hosts seem to allow without a seconf thought).

    I have remote access. echo "select...." | mysql -u me ..... -h remoteserver.com



    Or perhaps even a search engine (if the host isn't up to handling the traffic).

    Hmmmm hmmmmmmmmm have to look in to that

    Sound to me like the MySQL server can't handle what is being asked of it.

    My thoughs. I can't see the logs (if any) - though I could write a script, mysqlcheck, log not-closed. Then check against Apache logs. I've got a bot scan and a error at the same time???


    It isn't for you (or me) to give a hosting company any direction or argument. They will have logs to indicate these server errors and it is really up to them to find the cause and solution. All you can really do is try to keep track of when it occurs and keep submitting fault reports.

    Hmmm I hear you but... I spent 12 years as 4th level support, 1st level had a 3 ring binder and got paid $12/hr. 2d level had training and were pretty smart $x2. 3d didn't exist. Then there was my group, had acccess to code & programmers and were expected to track and solve everything right down to telling the programmers what the code error was. I remember one of the last problems "2d: Box E47 won't process, we've tried everything - even reboot." me: "hmmm, click, type, click, check Do a 'df'" 2d: "S***!!" One of the disks had filled, 1st missed it, 2d missed it. I'm not sure where my hosting support falls, really sharp on some things, had never heard of COPS. And DB problems they had off.

    Cheers
    RodG
    Just checked the apache logs. Looks like 50% of the logs entries with nddbc.html have the letters "bot" in the line. The IP with the most, 54.224.86.121, Amazon Tech. I also noticed that when I upgraded zen-cart robots.txt got lost, not put back. Will now sit back and watch.

    Thanks again for the help.

 

 

Similar Threads

  1. Replies: 30
    Last Post: 15 Apr 2016, 10:36 PM
  2. how do change the mysql socket?
    By rptodd1 in forum Installing on a Mac Server
    Replies: 5
    Last Post: 3 Mar 2009, 02:46 PM
  3. mysql.sock problem
    By lbooth in forum Installing on a Linux/Unix Server
    Replies: 4
    Last Post: 15 Nov 2007, 05:52 PM
  4. Database Backup Manager - MySQL - "cannot connect through socket" message
    By craiglove in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 17 May 2007, 11:43 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR