Reduce MySQL memory usage

This explenation is for Debian 6.0, may differ slightly for other distros.

First stop MySQL;

/etc/init.d/mysql stop

Create a bash script;

vim /var/startmysql.sh

Containing;

#! /bin/bash
ulimit -s 40
/etc/init.d/mysql start

From now on, start MySQL using this bash script.

But first, alter the MySQL config file;

vim /etc/mysql/my.cnf

In the [mysqld] part of the config, add;

skip-innodb

In my case this part looked like this at the end;

user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/english
skip-external-locking
skip-innodb

Leave a Reply

Your email address will not be published. Required fields are marked *