Question

MySQL on Ubuntu Keeps Crashing

  • Posted June 17, 2013

I’ve got an Ubuntu 12.x Droplet running, and for some reason MySQL keeps crashing to where I need to go in and restart the process (‘sudo service mysql restart’).

I’m not even sure how to start debugging this - could anyone give me some guidance on how to start? My MySQL logs are empty in /var/log/

Thanks!

Subscribe
Share

Having the same issue with a Wordpress on Ubuntu.

I’m having exactly the same issue. Did you manage to find a solution?

Good idea. I’ll try it out. I’ve been doing some research and memory seems to be the culprit. I’ve cleaned up memory usage but adding swap should definitely help. Thanks for the suggestion

I’m having the same problem. Did you find a solution?

I’ve experienced this as well on several droplets with the preconfigured WordPress setup DO offers. In my case, the servers affected are all running on the smallest hardware package using Ubuntu 14.0.4. Added a swap file to one of them but it didn’t make any difference, still keeps crashing.

This comment has been deleted


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

Finally this helped, none of other solution did any change (add swap, monitor for banned iP’s, upgrade droplet):

## Edit /etc/my.cnf, and add the following line under the [mysqld] heading.
[mysqld]
innodb_buffer_pool_size=64M
```

Then restart: `$  service mysql restart`

Finally this helped, none of other solution did any change (add swap, monitor for banned iP’s, upgrade droplet):

## Edit /etc/my.cnf, and add the following line under the [mysqld] heading.
[mysqld]
innodb_buffer_pool_size=64M
```

Then restart: `$  service mysql restart`

Finally this helped, none of other solution did any change (add swap, monitor for banned iP’s, upgrade droplet):

## Edit /etc/my.cnf, and add the following line under the [mysqld] heading.
[mysqld]
innodb_buffer_pool_size=64M
```

Then restart: `$  service mysql restart`

Finally this helped, none of other solution did any change (add swap, monitor for banned iP’s, upgrade droplet):

## Edit /etc/my.cnf, and add the following line under the [mysqld] heading.
[mysqld]
innodb_buffer_pool_size=64M
```

Then restart: `$  service mysql restart`

Finally this helped, none of other solution did any change (add swap, monitor for banned iP’s, upgrade droplet):

## Edit /etc/my.cnf, and add the following line under the [mysqld] heading.
[mysqld]
innodb_buffer_pool_size=64M
```

Then restart: `$  service mysql restart`

Finally this helped, none of other solution did any change (add swap, monitor for banned iP’s, upgrade droplet):

## Edit /etc/my.cnf, and add the following line under the [mysqld] heading.
[mysqld]
innodb_buffer_pool_size=64M
```

Then restart: `$  service mysql restart`

Finally this helped, none of other solution did any change (add swap, monitor for banned iP’s, upgrade droplet):

## Edit /etc/my.cnf, and add the following line under the [mysqld] heading.
[mysqld]
innodb_buffer_pool_size=64M
```

Then restart: `$  service mysql restart`

This is a pretty common issue with WordPress, certainly not the fault of the DO preconfigured instance as I’ve experienced the same spinning up my own DO instances as well as back when I used to use AWS EC2. Moving up to an instance with more memory may help temporarily, but you’ll likely still eventually come face to face with this issue.

My sites will typically work flawlessly for several months until eventually they start to become plagued with MySQL crashes. My solution almost always ends up being spinning up a new instance and migrating over where the 2-4 month cycle just repeats itself. I’ve yet to be able to pin down the root cause or a solution.

One rule of thumb I use when configuring a droplet with MySQL is I get all my processes running, then use top or landscape-sysinfo to see how much memory is free. Then I divide my free memory in half, that number is usually about 8-10M. Then I set the InnoDB buffer size to that amount to avoid having MySQL use up too much memory. This has cleared up 99% of my problems with MySQL crashing. <br>innodb_buffer_pool_size = 10M <br> <br>It can also help to use swap space, but it’s best to increase the size of your droplet as it degrades Digital Ocean’s hardware to use swap.