how to Optimize mysql server

lately i've been getting notices from nagios about my current load on my linux system. and looking at the logs, it looks like the problem is the mysql server.

the server that i have had 2G of memory, so i upgraded to 4G of memory, while i do see some improvements, i still see that mysql server is taking alot of resources from my server. sometimes up to 145% with two CPUs, which normally mysql uses about an average of 45% CPU. so the next step you can do is change your /etc/my.cnf

there is a file in /usr/share/doc/mysql-server-5.0.45 and its called my-huge.cnf so what you can do is replace /etc/my.cnf wiht /usr/share/doc/mysql-server-5.0.45/my-huge.cnf

now bare in mind that my server has version 5.0.45 so your's might be different, but you will most likely find it in 5.0.45 /usr/share/doc/. i have fedora core.

so this is how i did it: first login to your shell and send these command:

make a backup of your original file:
cp /etc/my.cnf /etc/my-original.cnf

replace the origianl file with the huge
cp /usr/share/doc/mysql-server-5.0.45/my-huge.cnf /etc/my.cnf

when asked:
cp: overwrite `/etc/my.cnf'?

type "y" for yes

now restart your mysql server:
/etc/init.d/mysqld restart

thats it.

if anyone has other good tips on how to maker your msyql server perform faster and better, please give me your comments, i would really appreciate it.