Link to database cannot be established

Jun 16, 2016
5
0
1
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
 

ssfred

Well-Known Member
Jan 6, 2012
65
4
58
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.
 
Jun 16, 2016
5
0
1
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 -
 
Last edited by a moderator:
Jun 16, 2016
5
0
1
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..
 
Last edited by a moderator:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,908
2,216
463
just restarted mysql service and my site back to normal.
Hello,

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

Thank you.
 

ssfred

Well-Known Member
Jan 6, 2012
65
4
58
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