Every Saturday night when a backup runs it crashes our site. We will either end up with a db connection error or just a white screen. Below are the mysql error logs. I’ve tried going through SSH and repairing the tables it lists as crashed and it says they successfully repair but then the next Saturday it crashes again and I get the same errors.

150510 7:56:41 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
150510 7:56:41 [Note] Plugin ‘FEDERATED’ is disabled.
150510 7:56:41 InnoDB: The InnoDB memory heap is disabled
150510 7:56:41 InnoDB: Mutexes and rwlocks use GCC atomic builtins
150510 7:56:41 InnoDB: Compressed tables use zlib 1.2.8
150510 7:56:41 InnoDB: Using Linux native AIO
150510 7:56:41 InnoDB: Initializing buffer pool, size = 128.0M
150510 7:56:41 InnoDB: Completed initialization of buffer pool
150510 7:56:41 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib
logfiles!
150510 7:56:41 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files…
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer…
150510 7:56:41 InnoDB: Waiting for the background threads to start
150510 7:56:42 InnoDB: 5.5.37 started; log sequence number 189133924
150510 7:56:42 [Note] Server hostname (bind-address): '127.0.0.1’; port: 3306
150510 7:56:42 [Note] - '127.0.0.1’ resolves to '127.0.0.1’;
150510 7:56:42 [Note] Server socket created on IP: '127.0.0.1’.
150510 7:56:42 [Note] Event Scheduler: Loaded 0 events
150510 7:56:42 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.5.37-0ubuntu0.14.04.1’ socket: ’/var/run/mysqld/mysqld.sock’ port: 3306 (Ubuntu)
150510 7:56:43 [ERROR] /usr/sbin/mysqld: Table ’./phpmyadmin/pmarecent’ is marked as crashed and should be repaired
150510 7:56:43 [Warning] Checking table: ’./phpmyadmin/pma
recent’
150510 7:56:43 [ERROR] /usr/sbin/mysqld: Table ’./wordpress/wpaiowpsloginactivity’ is marked as crashed and should be repaired
150510 7:56:43 [Warning] Checking table: ’./wordpress/wp
aiowpsloginactivity’
150510 7:56:43 [ERROR] /usr/sbin/mysqld: Table ’./wordpress/wplayerslider’ is marked as crashed and should be repaired
150510 7:56:43 [Warning] Checking table: ’./wordpress/wp
layerslider’
150510 7:56:43 [ERROR] /usr/sbin/mysqld: Table ’./wordpress/wpoptions’ is marked as crashed and should be repaired
150510 7:56:43 [Warning] Checking table: ’./wordpress/wp
options’
150510 7:56:43 [ERROR] /usr/sbin/mysqld: Table ’./wordpress/wppostmeta’ is marked as crashed and should be repaired
150510 7:56:43 [Warning] Checking table: ’./wordpress/wp
postmeta’
150510 7:56:43 [ERROR] /usr/sbin/mysqld: Table ’./wordpress/wpposts’ is marked as crashed and should be repaired
150510 7:56:43 [Warning] Checking table: ’./wordpress/wp
posts’
150510 7:56:43 [ERROR] /usr/sbin/mysqld: Table ’./wordpress/wpusermeta’ is marked as crashed and should be repaired
150510 7:56:43 [Warning] Checking table: ’./wordpress/wp
usermeta’

1 comment
  • You are running out of memory.... has nothing to do with the backups unless that’s consuming memory. To fix it. You either need to add more memory, or tune your services to use less memory.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
2 answers

This question was answered by @thinkingmedia:

You are running out of memory.... has nothing to do with the backups unless that’s consuming memory. To fix it. You either need to add more memory, or tune your services to use less memory.

View the original comment

Hello, focus

The key error here is:

InnoDB: Fatal error: cannot allocate memory for the buffer pool

This crash is due to your system running out of memory. I’d suggest that you add a swap file to give yourself a bit more of a buffer. Check out this tutorial:

How To Add Swap on Ubuntu 14.04

What you can also do is to use the MySQLTuner script.

The MySQLTuner is a script written in Perl and allows you to quickly test your MySQL configuration and it gives you suggestions for adjustments to increase performance and stability.

According to the official GitHub page, it supports 300 indicators for MySQL/MariaDB/Percona Server in this last version.

To run the script you could do the following:

  • SSH to your Droplet
  • Download the script:
wget http://mysqltuner.pl/ -O mysqltuner.pl
  • Then execute it:
perl mysqltuner.pl

The script would run multiple checks against your MySQL instance, all checks done by MySQLTuner are documented here.

Also as stated in the official documentation, it is still extremely important for you to fully understand each change you make to a MySQL database server. If you don’t understand portions of the script’s output, or if you don’t understand the recommendations, you should consult a knowledgeable DBA or system administrator that you trust.

As a good practice make sure to always test your changes on staging environments before implementing them on your production database.

On the same note, if you want to have a worry-free MySQL hosting and focus on your application, I would recommend trying out the DigitalOcean Managed Databases:

https://www.digitalocean.com/products/managed-databases-mysql/

This was mini tutorial was posted from @bobbyiliev in this question in our community: https://www.digitalocean.com/community/questions/how-to-tweak-mysql-mariadb-configuration-for-increased-performance-and-stability

Hope that this helps!
Regards,
Alex

by Justin Ellingwood
Swap space can be used as an "overflow" area for your system when you run out of RAM. The operating system can store data that would normally be kept in RAM on the hard drive in a specially formatted file. In this guide, we'll demonstrate how to create and use one of these files in Ubuntu 14.04.
Submit an Answer