To optimize the ram usage, if you got less than 1 gig ram on your server/vps, run this:
cp -f /usr/share/mysql/my-medium.cnf /etc/my.cnf
service mysqld restart
For 1-2 gig ram:
cp -f /usr/share/mysql/my-large.cnf /etc/my.cnf
service mysqld restart
and for more than 2 gig ram, run:
cp -f /usr/share/mysql/my-huge.cnf /etc/my.cnf
service mysqld restart