1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

"Cannot connect to DB" error

Discussion in 'MySQL' started by qwikad.com, Feb 5, 2014.

  1. #1
    This morning instead of my site I had this error. So, I searched the web and found out that restarting the DB should solve the issue. So I logged in as a root user, restarted the DB and sure enough everything was back to normal.

    Question, what causes this error and how can I prevent it next time around?
     
    qwikad.com, Feb 5, 2014 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    First off, that's definitely not supposed to happen. Second, since you're not providing any info about your setup, or what you're running (versions), it's hard to say what might have failed. Since a restart of the DB worked, it suggests that the problem lies with the DB or at least the server the DB runs on, but again, since you're providing no information, it's next to impossible to guess what was wrong. I would suggest looking at the server logs to find out exactly what went wrong, and then procede from there.
     
    PoPSiCLe, Feb 5, 2014 IP
  3. qwikad.com

    qwikad.com Illustrious Member Affiliate Manager

    Messages:
    7,151
    Likes Received:
    1,656
    Best Answers:
    29
    Trophy Points:
    475
    #3
    There was an alert I saw earlier (which now disappeared). It was something about "reaching 95% of memory usage". Which is total bull, because there's no chance in the world that I could've reached it. Unless there was some kind of bot attack.

    When I look at the Resources:

    CPU Usage is at 7.3%
    Memory Usage is at 32%
    Disc Space Usage is at 17%

    So it makes no sense why I got that alert this morning or why the DB needed restarting.

    Are there one or two common reasons that can shut down a DB?
     
    qwikad.com, Feb 5, 2014 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #4
    Could be a process that has hung - ie something that pulls or queries the DB constantly. Are you on a shared hosting? If so, (and if they're not configuring things properly), you'll have a max amount of CPU and memory available for ALL instances running on that server - if one of the OTHER instances all of a sudden starts draining resources, that might mean that your resourcepool gets smaller, and hence, your app crash. Not due to a fault of your own, but due to a fail in the resourcehandling on the server.
    If the logs / alert tells you that memory usage is at 95%, then it probably is - and it might be because of some logic in your app that doesn't run as you intended it to.
     
    PoPSiCLe, Feb 8, 2014 IP
  5. pmf123

    pmf123 Notable Member

    Messages:
    1,447
    Likes Received:
    75
    Best Answers:
    0
    Trophy Points:
    215
    #5
    I have an issue on my box where the web access logs are going crazy due to genuine traffic and google indexing, they clean up at night when my webalizer tool runs, but sometimes its over 10gb a day and space gets very low...
     
    pmf123, Aug 31, 2014 IP