NEW VPS Plans

ServerTune provides -- managed and un-managed -- VPS hosting solutions at affordable prices to accommodate your personal and/or businesses needs.

Click here for more info ...

NEW VPS Plans

Click to hideClick to view
ServerTune

Browse by category

Search    |    Advanced search

HowTo :: optimize MySQL server

There is a default MySQL conf file -- my.cnf -- that comes with MySQL distribution.

To optimize your MySQL server, copy the following variable into /PATH_TO/my.cnf file:
[mysqld]
bind-address=127.0.0.1
datadir=/var/lib/mysql
socket

					 		=/var/lib/mysql/mysql.sock
local-infile=0
skip-external-locking
long_query_time=5
slow_query_log=/var/log/mysql_slow_query.log
federated

query_cache_limit=8M 
query_cache_size=32M
query_cache_type=1

max_connections=20
max_user_connections=100
interactive_timeout=120
long_query_time=10
wait_timeout=60
connect_timeout=120

thread_cache_size=80
key_buffer=384M
join_buffer_size=20M
max_allowed_packet=64M
table_cache=512K
table_open_cache=512K
table_definition_cache=262144
tmp_table_size=512M
read_buffer_size=2M
sort_buffer_size=4M
key_buffer_size=512M
read_buffer_size=2M
max_connect_errors=10
myisam_sort_buffer_size=64M
read_rnd_buffer_size=8MB
thread_stack=192K

innodb_buffer_pool_size=2048M
innodb_additional_mem_pool_size=24M
innodb_log_buffer_size=6M

server-id=1
concurrent_insert=2
low_priority_updates=1

[mysql.server]
user=mysql

[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[mysql]
no-auto-rehash

[myisamchk]
key_buffer=32M
sort_buffer=32M
read_buffer_size=16M
write_buffer=16M

[mysqldump]
quick
max_allowed_packet=16M

Save the file, and restart MySQL:
Linux

FreeBSD

Download the following scripts to tune up every variable:

Printer Friendly
 
email to a friend
Email to friend
 
Add comment
Add comment
 
Views: 364
 
Votes: 0
 
Comments: 0
 
Posted: 29 Feb, 2008 by: Customer Service S.
Updated: 05 Mar, 2011 by: Customer Service S.

Other articles in this Category

Article
RSS