Author Topic: error establishing database connection  (Read 16192 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
error establishing database connection
« on: October 04, 2018, 06:05:51 AM »
Every day i have to restart mysql service because i get the message:
šerror establishing database connectionš

please advise
Herman

Offline
***
Re: error establishing database connection
« Reply #1 on: October 05, 2018, 07:26:49 AM »
Depends on number of factors. Can you paste here the mysql logs?

Offline
*
Re: error establishing database connection
« Reply #2 on: October 05, 2018, 12:20:39 PM »
thank you for the reply,
Which log files do you need?
Do you have filenames?

Offline
***
Re: error establishing database connection
« Reply #3 on: October 08, 2018, 04:32:24 AM »
what is output of this command

Code: [Select]
systemctl status mariadb.service -l

Offline
*
Re: error establishing database connection
« Reply #4 on: October 08, 2018, 10:19:35 AM »
here you have it.

● mariadb.service - MariaDB 10.1.36 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─migrated-from-my.cnf-settings.conf
   Active: active (running) since ma 2018-10-08 03:05:17 CEST; 9h ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 11940 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 11874 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
  Process: 11868 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
 Main PID: 11889 (mysqld)
   Status: "InnoDB: Error: Could not find a valid tablespace file for 'oudersb_blog/blogfak_wfVulnScanners'. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting-datadict.html for how to resolve the issue."
   CGroup: /system.slice/mariadb.service
           └─11889 /usr/sbin/mysqld

okt 08 04:08:11 srv1.bcoin.nl mysqld[11889]: 2018-10-08  4:08:11 139755295288064 [ERROR] Got error 180 when reading table './bcoin_wp/wp_posts'
okt 08 04:08:11 srv1.bcoin.nl mysqld[11889]: 2018-10-08  4:08:11 139755295288064 [ERROR] Got error 180 when reading table './bcoin_wp/wp_posts'
okt 08 04:08:11 srv1.bcoin.nl mysqld[11889]: 2018-10-08  4:08:11 139755295288064 [ERROR] Got error 180 when reading table './bcoin_wp/wp_posts'
okt 08 04:09:37 srv1.bcoin.nl mysqld[11889]: 2018-10-08  4:09:37 139755295288064 [ERROR] Got error 180 when reading table './bcoin_wp/wp_posts'
okt 08 04:09:37 srv1.bcoin.nl mysqld[11889]: 2018-10-08  4:09:37 139755295288064 [ERROR] Got error 180 when reading table './bcoin_wp/wp_posts'
okt 08 04:09:37 srv1.bcoin.nl mysqld[11889]: 2018-10-08  4:09:37 139755295288064 [ERROR] Got error 180 when reading table './bcoin_wp/wp_posts'
okt 08 04:09:37 srv1.bcoin.nl mysqld[11889]: 2018-10-08  4:09:37 139755295288064 [ERROR] Got error 180 when reading table './bcoin_wp/wp_posts'             
okt 08 04:10:59 srv1.bcoin.nl mysqld[11889]: 2018-10-08  4:10:59 139755397507840 [ERROR] Got error 180 when reading table './bcoin_wp/wp_posts'             
okt 08 04:10:59 srv1.bcoin.nl mysqld[11889]: 2018-10-08  4:10:59 139755397507840 [ERROR] Got error 180 when reading table './bcoin_wp/wp_posts'             
okt 08 04:10:59 srv1.bcoin.nl mysqld[11889]: 2018-10-08  4:10:59 139755397507840 [ERROR] Got error 180 when reading table './bcoin_wp/wp_posts'             
[root@srv1 ~]# Connection to 192.168.2.10 closed by remote host.                                                                                           
Connection to 192.168.2.10 closed.

Offline
*
Re: error establishing database connection
« Reply #5 on: October 08, 2018, 11:21:01 AM »
after reboot:

● mariadb.service - MariaDB 10.1.36 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─migrated-from-my.cnf-settings.conf
   Active: active (running) since ma 2018-10-08 13:19:01 CEST; 1min 16s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 1634 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 942 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
  Process: 931 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
 Main PID: 1068 (mysqld)
   Status: "Taking your SQL requests now..."
   CGroup: /system.slice/mariadb.service
           └─1068 /usr/sbin/mysqld

okt 08 13:18:48 srv1.bcoin.nl mysqld[1068]: 2018-10-08 13:18:48 140254624643328 [Note] InnoDB: Highest supported file format is Barracuda.
okt 08 13:18:57 srv1.bcoin.nl mysqld[1068]: 2018-10-08 13:18:57 140254624643328 [Note] InnoDB: 128 rollback segment(s) are active.
okt 08 13:18:57 srv1.bcoin.nl mysqld[1068]: 2018-10-08 13:18:57 140254624643328 [Note] InnoDB: Waiting for purge to start
okt 08 13:18:57 srv1.bcoin.nl mysqld[1068]: 2018-10-08 13:18:57 140254624643328 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.39-83.1 started; log sequence number 53883522243                                                                                                                           
okt 08 13:18:58 srv1.bcoin.nl mysqld[1068]: 2018-10-08 13:18:58 140254624643328 [Note] Plugin 'FEEDBACK' is disabled.                                       
okt 08 13:18:58 srv1.bcoin.nl mysqld[1068]: 2018-10-08 13:18:58 140253843154688 [Note] InnoDB: Dumping buffer pool(s) not yet started                       
okt 08 13:18:58 srv1.bcoin.nl mysqld[1068]: 2018-10-08 13:18:58 140254624643328 [Note] Server socket created on IP: '::'.                                   
okt 08 13:19:01 srv1.bcoin.nl mysqld[1068]: 2018-10-08 13:19:01 140254624643328 [Note] /usr/sbin/mysqld: ready for connections.                             
okt 08 13:19:01 srv1.bcoin.nl mysqld[1068]: Version: '10.1.36-MariaDB'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MariaDB Server                     
okt 08 13:19:01 srv1.bcoin.nl systemd[1]: Started MariaDB 10.1.36 database server.                     

Offline
***
Re: error establishing database connection
« Reply #6 on: October 08, 2018, 11:35:23 AM »
I see it started successfully. What issue you are facing then?

Offline
*
Re: error establishing database connection
« Reply #7 on: October 08, 2018, 12:17:05 PM »
thank you for the reply.  :D

I have to restart the server after a short time again because it loses mysql connection.

Offline
***
Re: error establishing database connection
« Reply #8 on: October 08, 2018, 12:44:20 PM »
whenever its down run the command below and paste here the output

Code: [Select]
systemctl status mariadb.service -l

Offline
*
Re: error establishing database connection
« Reply #9 on: October 08, 2018, 06:19:21 PM »
system acting weird again.
very much io activity and high memory usage.

systemctl status mariadb.service -l
● mariadb.service - MariaDB 10.1.36 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─migrated-from-my.cnf-settings.conf
   Active: active (running) since ma 2018-10-08 19:15:43 CEST; 1h 1min ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 30600 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 30533 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
  Process: 30529 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
 Main PID: 30548 (mysqld)
   Status: "InnoDB: Error: Database page corruption on disk or a failed file read of tablespace bcoin_wp/wp_posts page  [page id: space=10422, page number=42776]. You may have to recover from a backup."
   CGroup: /system.slice/mariadb.service
           └─30548 /usr/sbin/mysqld

okt 08 20:09:41 srv1.bcoin.nl mysqld[30548]: 2018-10-08 20:09:41 140492795878144 [ERROR] Got error 180 when reading table './bcoin_wp/wp_posts'
okt 08 20:11:01 srv1.bcoin.nl mysqld[30548]: 2018-10-08 20:11:01 140492392348416 [ERROR] Got error 180 when reading table './bcoin_wp/wp_posts'
okt 08 20:11:02 srv1.bcoin.nl mysqld[30548]: 2018-10-08 20:11:02 140492392348416 [ERROR] Got error 180 when reading table './bcoin_wp/wp_posts'
okt 08 20:11:02 srv1.bcoin.nl mysqld[30548]: 2018-10-08 20:11:02 140492392348416 [ERROR] Got error 180 when reading table './bcoin_wp/wp_posts'
okt 08 20:11:02 srv1.bcoin.nl mysqld[30548]: 2018-10-08 20:11:02 140492392348416 [ERROR] Got error 180 when reading table './bcoin_wp/wp_posts'
okt 08 20:12:13 srv1.bcoin.nl mysqld[30548]: 2018-10-08 20:12:13 140492392348416 [ERROR] Got error 180 when reading table './bcoin_wp/wp_posts'
okt 08 20:12:13 srv1.bcoin.nl mysqld[30548]: 2018-10-08 20:12:13 140492392348416 [ERROR] Got error 180 when reading table './bcoin_wp/wp_posts'
okt 08 20:12:14 srv1.bcoin.nl mysqld[30548]: 2018-10-08 20:12:14 140492392348416 [ERROR] Got error 180 when reading table './bcoin_wp/wp_posts'
okt 08 20:12:14 srv1.bcoin.nl mysqld[30548]: 2018-10-08 20:12:14 140492392348416 [ERROR] Got error 180 when reading table './bcoin_wp/wp_posts'
okt 08 20:12:14 srv1.bcoin.nl mysqld[30548]: 2018-10-08 20:12:14 140492392348416 [ERROR] Got error 180 when reading table './bcoin_wp/wp_posts'

Offline
***
Re: error establishing database connection
« Reply #10 on: October 09, 2018, 07:24:29 AM »
Looks like tables gets corrupted. You can set innodb recovery to automatic. Also you should contact your hosting provider to look into the issue. It may be caused because of lack of i/o or resources

Offline
*
Re: error establishing database connection
« Reply #11 on: October 09, 2018, 09:43:03 AM »
thank you for the reply.

I guess its a wordpress table issue causing the problems.
I shut down the websites plugins and everything looks fine.

how to prevent one website from taking down the server?

 

Offline
***
Re: error establishing database connection
« Reply #12 on: October 09, 2018, 03:13:31 PM »
Well you should look for cloudlinux. They have MySQL Governor to protect MySQL operations.

https://docs.cloudlinux.com/index.html?mysql_governor.html