I'm running WordPress on a DigitalOcean 512MB Ubuntu 16.04.1 Server. Since today morning the website only shows "Error establishing a database connection".
Seems like the MySQL server isn't running. So i tried $ mysqladmin -u root -p status
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
So I tried $ sudo /etc/init.d/mysql start
wich got me
[....] Starting mysql (via systemctl): mysql.serviceJob for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
failed!
trying
$ systemctl status mysql.service
got me
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (start-post) (Result: exit-code) since Mon 2016-12-05 15:41:48 UTC; 854ms ago
Process: 13270 ExecStart=/usr/sbin/mysqld (code=exited, status=2)
Process: 13266 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 13270 (code=exited, status=2); : 13271 (mysql-systemd-s)
Tasks: 2
Memory: 380.0K
CPU: 562ms
CGroup: /system.slice/mysql.service
└─control
├─13271 /bin/bash /usr/share/mysql/mysql-systemd-start post
└─13276 sleep 1
I'm unable to find what Process: 13270 ExecStart=/usr/sbin/mysqld (code=exited, status=2)
means. Online I only found errors with status 1.
journalctl -xe
got me:
Hint: You are currently not seeing messages from other users and the system.
Users in groups 'adm', 'systemd-journal' can see all messages.
Pass -q to turn off this notice.
Dec 05 11:21:51 wpc-experte-droplet systemd[2570]: Received SIGRTMIN+24 from PID 2686 (kill).
-- Reboot --
Dec 05 11:25:13 wpc-experte-droplet systemd[2083]: Reached target Timers.
-- Subject: Unit UNIT has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit UNIT has finished starting up.
--
-- The start-up result is done.
Dec 05 11:25:13 wpc-experte-droplet systemd[2083]: Reached target Sockets.
-- Subject: Unit UNIT has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit UNIT has finished starting up.
--
-- The start-up result is done.
Dec 05 11:25:13 wpc-experte-droplet systemd[2083]: Reached target Paths.
-- Subject: Unit UNIT has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit UNIT has finished starting up.
--
-- The start-up result is done.
Dec 05 11:25:13 wpc-experte-droplet systemd[2083]: Reached target Basic System.
-- Subject: Unit UNIT has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit UNIT has finished starting up.
--
-- The start-up result is done.
Dec 05 11:25:13 wpc-experte-droplet systemd[2083]: Reached target Default.
-- Subject: Unit UNIT has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit UNIT has finished starting up.
--
-- The start-up result is done.
Dec 05 11:25:13 wpc-experte-droplet systemd[2083]: Startup finished in 115ms.
-- Subject: System start-up is now complete
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- All system services necessary queued for starting at boot have been
-- successfully started. Note that this does not mean that the machine is
-- now idle as services might still be busy with completing start-up.
--
-- Kernel start-up required KERNEL_USEC microseconds.
--
-- Initial RAM disk start-up required INITRD_USEC microseconds.
--
-- Userspace start-up required 115249 microseconds.
Dec 05 13:36:55 wpc-experte-droplet sshd[4829]: Timeout, client not responding.
Dec 05 15:09:37 wpc-experte-droplet sshd[5718]: Timeout, client not responding.
Dec 05 15:31:18 wpc-experte-droplet sshd[2142]: Timeout, client not responding.
lines 6777-6835/6835 (END)
On Sunday everything worked and since Monday morning it doesn't. I also updating ubuntu and restarting the whole system at several points.
Update:
The /mysql/error.log is ~80MB large and contains
2016-12-05T06:25:29.601993Z 0 [ERROR] InnoDB: Database page corruption on disk or a failed file read of page [page id: space=0, page number=5]. You may have to recover from a backup.
My last backup was 3 months old but I could only recover from that and had to reenter a lot of stuff on the website manually and I lost a document that wasn't cached by Google or backed up by me.