MySQL uses algorithms that are very scalable, so you can usually
run with very little memory. However, normally you get better
performance by giving MySQL more memory.

When tuning a MySQL server, the two most important variables to
configure are key_buffer_size
and table_open_cache. You
should first feel confident that you have these set
appropriately before trying to change any other variables.

The following examples indicate some typical variable values for
different runtime configurations.

If you have at least 256MB of memory and many tables and
want maximum performance with a moderate number of clients,
use something like this:

If you have only 128MB of memory and only a few tables, but
you still do a lot of sorting, you can use something like
this:

shell> mysqld_safe --key_buffer_size=16M --sort_buffer_size=1M

If there are very many simultaneous connections, swapping
problems may occur unless mysqld has been
configured to use very little memory for each connection.
mysqld performs better if you have enough
memory for all connections.

If you are performing GROUP BY or
ORDER BY operations on tables that are much
larger than your available memory, increase the value of
read_rnd_buffer_size to speed
up the reading of rows following sorting operations.

If you specify an option on the command line for
mysqld or mysqld_safe, it
remains in effect only for that invocation of the server. To use
the option every time the server runs, put it in an option file.

To see the effects of a parameter change, do something like
this:

shell> mysqld --key_buffer_size=32M --verbose --help

The variable values are listed near the end of the output. Make
sure that the --verbose and
--help options are last.
Otherwise, the effect of any options listed after them on the
command line are not reflected in the output.