I m having a VPS server and it used to eat up lot of RAM due to MySql so i google about optimizing it and i found out so i would like to share it with you also just edit your my.cnf to the below values [mysqld] max_connections = 400 key_buffer = 16M myisam_sort_buffer_size = 32M join_buffer_size = 1M read_buffer_size = 1M sort_buffer_size = 2M table_cache = 1024 thread_cache_size = 286 interactive_timeout = 25 wait_timeout = 1000 connect_timeout = 10 max_allowed_packet = 16M max_connect_errors = 10 query_cache_limit = 1M query_cache_size = 16M query_cache_type = 1 tmp_table_size = 16M skip-innodb [mysqld_safe] open_files_limit = 8192 [mysqldump] quick max_allowed_packet = 16M [myisamchk] key_buffer = 32M sort_buffer = 32M read_buffer = 16M write_buffer = 16M Code (markup): Hope it works with you also i m getting some good results out of it
A bit part of optimization is the table structures themselves. Keep this in mind. Avoid larger types such as TEXT and BLOB. Also use table joins when storing large amounts of values.
MySQL configuration variables lot depend on the amount of RAM available, size of database and size of index. Optimizing your queries is a key part to get better performance out of MySQL.
The two variables I have found help the most with MySQL are: key_buffer_size and table_cache. However, both involve using more memory (as you crank them up). So the optimal solution for you may be to find suitable values for these two and make sure your tables are properly indexed.
Forgot to also add that query_cache size can also make a difference if you have a queries that have small result sets but query tables with many rows. But again, making it larger increases memory usage.