登陆 免费注册 提交网站
站长资讯 >> 站长学院 >> 服务器类
 2014-05-15 22:25浏览: 1152 次

MySQL 5.5.30服务器端优化

/etc/my.cnf配置文件

 

[client]

port            = 3306

socket          = /tmp/mysql.sock

 

 

[mysqld]

####  mise  ####

user = mysql

port            = 3306

socket          = /tmp/mysql.sock

basedir = /data/mysql

datadir = /data/mysql/data

pid-file=/data/mysql/mysqld.pid

#default-storage-engine = MYISAM

ft_min_word_len = 4

max_allowed_packet = 32M

character-set-server = utf8

skip-name-resolve

 

 

####  performance  ####

open_files_limit = 10240

max_connections = 800

max_connect_errors = 6000

thread_stack = 192K

transaction_isolation = REPEATABLE-READ

tmp_table_size = 256M

max_heap_table_size = 256M

slow_query_log

long_query_time = 1

log_slow_queries=/data/mysql/slow-log.log

 

 

#### log ####

log-error=/data/mysql/mysqld.err

back_log = 500

log-bin=mysql-bin

max_binlog_cache_size = 8M

max_binlog_size = 512M

binlog_format=mixed

expire_logs_days = 7

 

 

####  buffer && cache  ####

read_buffer_size = 10M

read_rnd_buffer_size = 32M

sort_buffer_size = 2M

join_buffer_size = 2M

thread_cache_size = 300

thread_concurrency = 8

query_cache_size = 64M

query_cache_limit = 4M

binlog_cache_size = 4M

table_open_cache = 2048

key_buffer_size = 32M

bulk_insert_buffer_size = 64M

 

 

####  myisam  ####

myisam_sort_buffer_size = 128M

myisam_max_sort_file_size = 10G

myisam_repair_threads = 1

myisam_recover

 

 

####  innodb  ####

innodb_additional_mem_pool_size = 16M

innodb_buffer_pool_size = 4G

innodb_data_file_path = ibdata1:1024M:autoextend

innodb_write_io_threads = 8

innodb_read_io_threads = 8

innodb_thread_concurrency = 16

innodb_flush_log_at_trx_commit = 2

innodb_log_buffer_size = 16M

innodb_log_file_size = 150M

innodb_log_files_in_group = 3

innodb_max_dirty_pages_pct = 90

innodb_lock_wait_timeout = 60

innodb_flush_method = O_DIRECT

 

####  replication  ####

replicate-ignore-db = mysql

replicate-ignore-db = test

replicate-ignore-db = information_schema

server-id = 1

 

[mysqldump]

quick

max_allowed_packet = 16M

 

[mysql]

no-auto-rehash

 

[myisamchk]

key_buffer_size = 32M

sort_buffer_size = 32M

read_buffer = 8M

write_buffer = 8M

 

[mysqlhotcopy]

interactive-timeout

 

[mysqld_safe]

open-files-limit = 8196

网站首页 - 关于我们 - 联系我们 - 友情链接 - 帮助中心
Copyright ©2007-2022 www.Aisila.com All Rights Reserved
苏ICP备20008864号-4