MySQL Crashing Randomly or Frequently

Experiencing MySQL crashes on your VPS now and then (or often)? The most probable cause is that it's bumping into the open files limit set by MySQL's default configuration options.

The standard open files limit stands at 1024. This works for a handful of websites, but when hosting numerous sites, this number needs a boost.

1. SSH into root

2. Enter: vi /etc/security/limits.conf

Adjust the lines to look like:

* soft nofile 1024000

* hard nofile 1024000

* soft nproc 10240

* hard nproc 10240

Save: Press Shift + ; then type wq!

3. Enter: vi /etc/security/limits.d/90-nproc.conf

Adjust the lines to look like:

* soft nofile 1024000

* hard nofile 1024000

* soft nproc 10240

* hard nproc 10240

root soft nproc unlimited

Save: Press Shift + ; then type wq!

4. Enter: ulimit -Hn 1024000

5. Enter: vi /etc/my.cnf

Add the following:

open_files_limit = 1024000

If there are sections [mysqld] and [mysqld_safe], place the line under both.

Save: Press Shift + ; then type wq!

6. Enter: service mysql restart

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Do I use localhost or remotemysqlhost for my mysql connection?

You can view whether your account is using localhost or remotemysql host in your cPanel account....

How can I connect to a MySQL database from Dreamweaver?

To connect to a MySQL database from Dreamweaver follow the below steps:Login to your cPanel...

How do I create a MySQL backup?

There are two ways to back up your MySQL databases. You can use the backup utility in your cPanel...

I would like to dump the Table Structure for my MySQL Database, but none of the data.

The command line option from SSH is: mysql -d -p database_name > file.sql. Where...

How do I create a MySQL database?

To create a MySQL database please follow the steps below:- Login to your control panel at...