生产服务器mysql my.cnf配置

# The following options will be passed to all MySQL clients
[client]
#password    = your_password
character-set-server = utf8
port        = 3306
socket        = /tmp/mysql.sock
 
# The MySQL server
[mysqld]
#user    = mysql
port        = 3306
socket        = /tmp/mysql.sock
basedir = /usr/local/mysql
datadir = /home/mysql/data
#启用错误日志
#log-error = mysql-bin.err
log-error = /home/mysql/mysql_error.log
pid-file = /home/mysql/mysql.pid
open_files_limit    = 10240
back_log = 600
#全局最大并发
max_connections = 5000
#单账户最大并发
max_user_connections=3000
max_connect_errors = 6000
table_cache = 614
external-locking = FALSE
#skip-external-locking
max_allowed_packet = 32M
sort_buffer_size = 1M
join_buffer_size = 1M
thread_cache_size = 300
#thread_concurrency = 8
query_cache_size = 512M
query_cache_limit = 2M
query_cache_min_res_unit = 2k
default-storage-engine = MyISAM
thread_stack = 192K
transaction_isolation = READ-COMMITTED
tmp_table_size = 246M
max_heap_table_size = 246M
long_query_time = 3
log-slave-updates
binlog_cache_size = 4M
#启用二进制日志
#log-bin = mysql-bin
log-bin = /home/mysql/binlog/mysql-bin
# 二进制格式日志三种类型 Mixed,Statement,Row
#binlog_format = “STATEMENT”
#binlog_format = “ROW”
binlog_format = MIXED
max_binlog_cache_size = 8M
max_binlog_size = 1G
relay-log-index = /home/mysql/relaylog/relaylog
relay-log-info-file = /home/mysql/relaylog/relaylog
relay-log = /home/mysql/relaylog/relaylog
expire_logs_days = 30
key_buffer_size = 256M
read_buffer_size = 1M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover
 
log-slow-queries = /home/mysql/slow.log
long_query_time = 5
 
 
interactive_timeout = 120
wait_timeout = 120
 
#replicate-ignore-db = mysql
replicate-ignore-db = test
replicate-ignore-db = information_schema
 
#设置服务器id
server-id = 2
#复制所有库除了
#binlog_ignore_db = mysql,test
#仅复制
#binlog_do_db = mysql,test
 
skip-name-resolve
#master-connect-retry = 10
slave-skip-errors = 1032,1062,126,1114,1146,1048,1396
 
#master-host     =   192.168.1.2
#master-user     =   username
#master-password =   password
#master-port     =  3306
 
 
 
# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /usr/local/mysql/var
#innodb_data_file_path = ibdata1:256M:autoextend
#innodb_log_group_home_dir = /usr/local/mysql/var
# You can set .._buffer_pool_size up to 50 – 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 512M
#innodb_additional_mem_pool_size = 16M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 126M
#innodb_log_buffer_size = 16M
#innodb_flush_log_at_trx_commit = 2
#innodb_lock_wait_timeout = 120
 
#innodb_file_io_threads = 4
#innodb_thread_concurrency = 8
#innodb_log_files_in_group = 3
#innodb_max_dirty_pages_pct = 90
#innodb_file_per_table = 0
 
[mysqldump]
quick
max_allowed_packet = 32M

发表回复