Monday, 1 June 2015

mysql database optimization tips

Go To > cd /etc/My.cnf
after Vim My.cnf  and replace All content With This Script

[mysqld]
innodb_file_per_table=1
innodb_buffer_pool_size=123M
innodb_additional_mem_pool_size=30M
innodb_log_buffer_size=30M
innodb_thread_concurrency=4

query_cache_size=64M
thread_cache_size=4 # can be increased on servers with large numbers of active users
key_buffer_size=32M
max_allowed_packet=268435456
table_open_cache=1024 # max 2048, can be increased if more Opened tables - SHOW STATUS LIKE 'Opened_tables';
wait_timeout=300 # can be increased if using persistent connections
max_user_connections=25
open_files_limit=16384

#delayed_insert_timeout=20 # Turn on if max_connections being reached due to delayed inserts
#delayed_queue_size=300 # Turn on if max_connections being reached due to delayed inserts

myisam_sort_buffer_size=2M # can be increased per sessions if needed for alter tables (indexes, repair)

#query_cache_limit=2M # leave at default unless there is a good reason
#join_buffer=2M # leave at default unless there is a good reason
#sort_buffer_size=2M # leave at default unless there is a good reason
#read_rnd_buffer_size=256K # leave at default unless there is a good reason
#read_buffer_size=2M # leave at default unless there is a good reason

collation_server=utf8_unicode_ci
character_set_server=utf8

#tmpdir=/dev/shm
tmp_table_size = 384M
max_heap_table_size = 384M
max_connections=125 # Should be between 100-150, increase *slowly* because it causes MySQL to consume more memory!
------------------------------------------------------------------------------------------------------------------------

After  Check it 100% Working Fine and Your website Mysql DB is Optimize.

No comments:

Post a Comment