# my.cnf for MySQL 5.1 # # Revision history: # Mark Grennan - 5/18/2011 - Complete replacement of default my.cnf file. # 3/16/2011 - Scann Blog space for knowlage on each variable. # # This is my example, with simple explinations, of my.cnf settings for a 5.1.xx server using # MyISAM almost exclusively with tens of thoudands of queries per second from 20 applications. # I use this as starting point for new servers. The OS directories structure is for RedHat (CentOS) 5.x. # # Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # [mysqld] user = mysql datadir = /data/mysql socket = /data/mysql/mysql.sock pid-file = /data/mysql/mysql.pid # BINARY LOGGING log_bin = /data/mysql/mysql-bin expire_logs_days = 7 # Good for transaction recovery sync_binlog = 1 server-id = 1 # each server doing replication requires a unique ID sync_binlog = 1 # Write every # transactions to disk. 0 = Use OS syncing slave_net_timeout = 60 read_only = 0 # This should be set to 1 on slaves # NETWORK OPTIONS #skip_name_resolve = 1 # Skip DNS lookup. Access will need IP addresses. bind-address = 0.0.0.0 # Address (interface) to bind too. port = 3306 # network port number max_connections = 150 # number of simultaneous client connections allowed max_user_connections = 0 # number of connections a user can make # SSL Connections see mysql-keys.sh #ssl-ca = /etc/mysql/ca-cert.pem #ssl-cert = /etc/mysql/server-cert.pem #ssl-key = /etc/mysql/server-key.pem # NETWORK SAFTY max_connect_errors = 10000 # IO to a user stops after this # of bad connections. One good connect reset it. max_allowed_packet = 16m # How big is your BLOB? sql_mode = STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ONLY_FULL_GROUP_BY # MyISAM key_buffer_size = 8M # Should be 1/4 of RAM nad less then 75% of total RAM myisam_recover = FORCE,BACKUP # MyISAM CACHING table_open_cache = 10240 # number of open tables for all threads (Think tables * connections) should be N * 1024 tmp_table_size = 32M max_heap_table_size = 32M # maximum size to which MEMORY tables are allowed to grow query_cache_type = 0 # 0 = ON 1 = OFF 2 =DEMAND : query_cache_size = 0 # caching query Sizes > 128M may reduce performance query_cache_limit = 8M # Don't cache results that are larger than this number of bytes. thread_cache_size = 50 # How many threads the server should cache for reuse # InnoDB innodb = FORCE # Force InnoDB to start innodb_data_home_dir = /data/mysql # Uncomment the following if you are using InnoDB tables innodb_log_group_home_dir = /data/mysql innodb_flush_method = O_DIRECT # should be unsed on Linux systems innodb_file_per_table = 1 innodb_buffer_pool_size = 8M # You can set .._buffer_pool_size up to 50 - 80 % # of RAM but beware of setting memory usage too high # and it should be greater then 512M for production servers. innodb_log_file_size = 32M # Set .._log_file_size to 25 % of buffer pool size innodb_log_buffer_size = 8M # size in bytes of the buffer that InnoDB uses to write to the log files on disk innodb_flush_log_at_trx_commit = 2 # LOGGING log-error = /data/mysql/error.log log-slow-queries = /data/mysql/slow.log log-output = FILE # Plugins # PERCONA OPTIONS innodb_file_per_table = 1 innodb_file_format = barracuda innodb_strict_mode = 1 plugin-load=handlersocket.so # enable Handler Socket loose_handlersocket_port = 9998 # the port number to bind to (for read requests) loose_handlersocket_port_wr = 9999 # the port number to bind to (for write requests) loose_handlersocket_threads = 16 # the number of worker threads (for read requests) loose_handlersocket_threads_wr = 1 # the number of worker threads (for write requests) open_files_limit = 65535 # to allow handlersocket accept many concurrent # connections, make open_files_limit as large as # possible