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.

Link to database cannot be established

Discussion in 'Database Discussions' started by Arsalan Ansari, Jun 16, 2016.

  1. Arsalan Ansari

    Joined:
    Jun 16, 2016
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Karachi
    cPanel Access Level:
    Root Administrator
    Its not often but am getting error (usually 2 or more time a day) when i am trying to open my site "Link to database cannot be established: SQLSTATE[HY000] [2006] MySQL server has gone away" at this stage my site not respond anything. If i restart mysql service ever thing back to normal but not for long.

    What should i need to do to resolve that issue???

    Configuration---
    CENTOS 6.7 x86_64 vmware
    WHM 54.0 (build 16)
    MYSQL Server version: 5.5.48-cll
     
  2. ssfred

    ssfred Well-Known Member

    Joined:
    Jan 6, 2012
    Messages:
    62
    Likes Received:
    2
    Trophy Points:
    8
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello :)

    Please check the current MySQL activity during the time of the issue by executing the following command

    From Shell:

    #mysqladmin proc stat

    From MySQL Shell

    mysql> show processlist;

    Also check the MySQL server logs /var/lib/mysql/hostname.err for any error messages.
     
  3. Arsalan Ansari

    Joined:
    Jun 16, 2016
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Karachi
    cPanel Access Level:
    Root Administrator
    hello ssfred
    Thanks for the reply. the only thing what i checked is MySQL server logs but i will check you suggested command during the issue. please check MySQL server logs.

    - Removed Please Attach Images to Your Posts -
     
    #3 Arsalan Ansari, Jun 17, 2016
    Last edited by a moderator: Jun 17, 2016
  4. twhiting9275

    twhiting9275 Well-Known Member

    Joined:
    Sep 26, 2002
    Messages:
    538
    Likes Received:
    15
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Twitter:
    What do the logs say at the time?
     
  5. Arsalan Ansari

    Joined:
    Jun 16, 2016
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Karachi
    cPanel Access Level:
    Root Administrator
    Hi twhiting,
    Thanks for the response. My current logs say at the time as follow...

    Code:
    150729 01:37:24 mysqld_safe Starting mysqld daemon with databases from /var/lib/  mysql
    150729  1:37:24 [Note] Plugin 'FEDERATED' is disabled.
    150729  1:37:24 InnoDB: The InnoDB memory heap is disabled
    150729  1:37:24 InnoDB: Mutexes and rw_locks use GCC atomic builtins
    150729  1:37:24 InnoDB: Compressed tables use zlib 1.2.3
    150729  1:37:24 InnoDB: Using Linux native AIO
    150729  1:37:24 InnoDB: Initializing buffer pool, size = 128.0M
    150729  1:37:24 InnoDB: Completed initialization of buffer pool
    InnoDB: The first specified data file ./ibdata1 did not exist:
    InnoDB: a new database to be created!
    150729  1:37:24  InnoDB: Setting file ./ibdata1 size to 10 MB
    InnoDB: Database physically writes the file full: wait...
    150729  1:37:24  InnoDB: Log file ./ib_logfile0 did not exist: new to be created
    InnoDB: Setting log file ./ib_logfile0 size to 5 MB
    InnoDB: Database physically writes the file full: wait...
    150729  1:37:24  InnoDB: Log file ./ib_logfile1 did not exist: new to be created
    InnoDB: Setting log file ./ib_logfile1 size to 5 MB
    InnoDB: Database physically writes the file full: wait...
    InnoDB: Doublewrite buffer not found: creating new
    InnoDB: Doublewrite buffer created
    InnoDB: 127 rollback segment(s) active.
    InnoDB: Creating foreign key constraint system tables
    InnoDB: Foreign key constraint system tables created
    150729  1:37:25  InnoDB: Waiting for the background threads to start
    150729  1:37:26 InnoDB: 5.5.42 started; log sequence number 0
    150729  1:37:26 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
    150729  1:37:26 [Note]  - '0.0.0.0' resolves to '0.0.0.0';
    150729  1:37:26 [Note] Server socket created on IP: '0.0.0.0'.
    150729  1:37:26 [Note] Event Scheduler: Loaded 0 events
    150729  1:37:26 [Note] /usr/sbin/mysqld: ready for connections.
    Version: '5.5.42-cll'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Co  mmunity Server (GPL)
    150729  1:37:32 [Note] /usr/sbin/mysqld: Normal shutdown
    
    150729  1:37:32 [Note] Event Scheduler: Purging the queue. 0 events
    150729  1:37:34  InnoDB: Starting shutdown...
    150729  1:37:35  InnoDB: Shutdown completed; log sequence number 1595675
    150729  1:37:35 [Note] /usr/sbin/mysqld: Shutdown complete
    
    150729 01:37:35 mysqld_safe mysqld from pid file /var/lib/mysql/srv.server.com.p  id ended
    150729 01:37:35 mysqld_safe Starting mysqld daemon with databases from /var/lib/  mysql
    150729  1:37:35 [Note] Plugin 'FEDERATED' is disabled.
    150729  1:37:35 InnoDB: The InnoDB memory heap is disabled
    150729  1:37:35 InnoDB: Mutexes and rw_locks use GCC atomic builtins
    150729  1:37:35 InnoDB: Compressed tables use zlib 1.2.3
    150729  1:37:35 InnoDB: Using Linux native AIO
    150729  1:37:35 InnoDB: Initializing buffer pool, size = 128.0M
    150729  1:37:35 InnoDB: Completed initialization of buffer pool
    150729  1:37:35 InnoDB: highest supported file format is Barracuda.
    150729  1:37:35  InnoDB: Waiting for the background threads to start
    150729  1:37:36 InnoDB: 5.5.42 started; log sequence number 1595675
    150729  1:37:36 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
    150729  1:37:36 [Note]  - '0.0.0.0' resolves to '0.0.0.0';
    150729  1:37:36 [Note] Server socket created on IP: '0.0.0.0'.
    150729  1:37:36 [Note] Event Scheduler: Loaded 0 events
    150729  1:37:36 [Note] /usr/sbin/mysqld: ready for connections.
    Version: '5.5.42-cll'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Co  mmunity Server (GPL)
    150729  2:42:29 [Note] /usr/sbin/mysqld: Normal shutdown
    
    150729  2:42:29 [Note] Event Scheduler: Purging the queue. 0 events
    150729  2:42:31 [Warning] /usr/sbin/mysqld: Forcing close of thread 71  user: 'e  ximstats'
    
    150729  2:42:31 [Warning] /usr/sbin/mysqld: Forcing close of thread 64  user: 'l  eechprotect'
    
    150729  2:42:31  InnoDB: Starting shutdown...
    150729  2:42:33  InnoDB: Shutdown completed; log sequence number 1683063
    150729  2:42:33 [Note] /usr/sbin/mysqld: Shutdown complete
    
    150729 02:42:33 mysqld_safe mysqld from pid file /var/lib/mysql/srv.server.com.p  id ended
    
    
    and currently my site is down.
    - Removed -
    please help..
     
    #5 Arsalan Ansari, Jun 18, 2016
    Last edited by a moderator: Jun 18, 2016
  6. Arsalan Ansari

    Joined:
    Jun 16, 2016
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Karachi
    cPanel Access Level:
    Root Administrator
    just restarted mysql service and my site back to normal.
     
  7. 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,

    I'm happy to see your website is running well. Could you verify if the issue is now resolved?

    Thank you.
     
  8. Arsalan Ansari

    Joined:
    Jun 16, 2016
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Karachi
    cPanel Access Level:
    Root Administrator
    Hi,
    Yes its back to normal but not for long time as i mentioned in my earlier post. That's not a solution
     
  9. ssfred

    ssfred Well-Known Member

    Joined:
    Jan 6, 2012
    Messages:
    62
    Likes Received:
    2
    Trophy Points:
    8
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello :)

    Check whether there is any memory availability issues. Some times OOM killer may trigger termination of MySQL processes, if the primary memory availability is low and MySQL is showing a high memory usage. You check it using the command

    #egrep -i "oom|kill|mysql" /var/log/messages
     
Loading...

Share This Page