MySQL配置文件优化

# MySQL一般配置样本
#
# 作者:贾益飞
# 时间:2015年夏
#
# 大家可以用这个生成配置文件后再修改 
# http://tools.percona.com/wizard

# 客户端读取默认配置
[client]
#password = "123456"
port = 3306
socket = /tmp/mysql.sock
default-character-set=utf8

# The MySQL server
[mysqld]
port = 3306
socket = /tmp/mysql.sock

# 数据目录
datadir = /usr/local/mysql/var

# 禁用外部锁定检查,单服务器环境
skip-external-locking

key_buffer_size    = 128M
max_allowed_packet = 8M
table_open_cache   = 1024
net_buffer_length  = 2M
read_buffer_size   = 4M
read_rnd_buffer_size    = 16M
sort_buffer_size        = 32M
myisam_sort_buffer_size = 256M
character-set-server=utf8
# 跳过DNS解析
skip-name-resolve 

# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8
thread_cache_size  = 8
max_connections  = 1024
tmp_table_size   = 256M  
wait_timeout     = 60000 
query_cache_size = 84M
query_cache_type = 1

# Replication Master Server (default)
# 开启2进制日志
log-bin=mysql-bin

# 2进制格式,推荐mixed
binlog_format=mixed
# 日志过期天数
expire_logs_days = 7

# server-id设置值,推荐使用IP末尾数值
server-id = 72

slow-query-log   = 1
long_query_time  = 2 
slow-query-log-file   = /usr/local/mysql/var/slow.log

innodb_data_home_dir  = /usr/local/mysql/var
innodb_data_file_path = ibdata1:20M: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 = 20M
innodb_additional_mem_pool_size = 4M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
# 设置为0就是等到innodb_log_buffer_size列队满后再统一储存,默认为1
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
# 开启InnoDB单表空间独立
innodb_file_per_table = 1
[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[myisamchk]
key_buffer_size  = 20M
sort_buffer_size = 20M
read_buffer  = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30290247/viewspace-1745604/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/30290247/viewspace-1745604/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值