my.cnf

There is a small text file called my.cnf that is part of the MySQL installation for Linux servers. Below is an example of the my.cnf settings. Restart the MySQL service after making changes to my.cnf.

Note: These are untested examples. Further configuration may be required.


MyISAM Example

[mysqld]

datadir=/var/lib/mysql

default-storage-engine=MyISAM

skip-innodb

max_allowed_packet=40M

lower_case_table_names=1


InnoDB Example

[mysqld]port = 3306

socket = /var/run/mysqld/mysql.sock

default_character_set = utf8

default_storage_engine = InnoDB

max_connections = 500

max_user_connections = 500

interactive_timeout = 28800

wait_timeout = 28800

lower_case_table_names = 1

max_allowed_packet = 40M

max_connect_errors = 1000

skip_name_resolve

binlog_format = ROW

expire_logs_days = 4

sync_binlog = 1

tmp_table_size = 64M

max_heap_table_size = 64M

query_cache_type = 0

query_cache_size = 0

thread_cache_size = 500

open_files_limit = 65535

table_definition_cache = 1024

table_open_cache = 1024

net_buffer_length = 16K

thread_stack = 512K

sort_buffer_size = 2M

read_buffer_size = 2M

read_rnd_buffer_size = 8M

join_buffer_size = 128M

binlog_cache_size = 1M

innodb_flush_method = O_DIRECT

innodb_log_files_in_group = 3

innodb_log_file_size = 1G

innodb_flush_log_at_trx_commit = 1

innodb_file_per_table = 1

innodb_buffer_pool_size = 1G

innodb_locks_unsafe_for_binlog = 1

innodb_autoinc_lock_mode = 2

interactive_timeout = 500

wait_timeout = 500

connect_timeout = 10

slow_query_log = 1

slow_query_log_file = mysql-slow.log