Mysql配置优化(Innodb)

本文分享了针对Mysql Innodb存储引擎的一系列优化配置方案,包括调整内存池大小、日志文件设置等,旨在提升数据库性能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

============================================================================

原创作品,允许转载。转载时请务必以超链接形式标明原始出处、以及本声明。

请注明转自:http://yunjianfei.iteye.com/blog/

============================================================================

在使用Mysql的过程中,数据达到不同的量级,都要进行相应的优化,否则会成为整个系统的瓶颈。

下面是我针对Innodb做出的一些优化,贴出来做个记录。有兴趣的同学可以根据里头的参数去Mysql官网查看具体参数的用法、定义以及优化措施。

文件:my.cnf
[mysqld]
default-character-set=utf8
#default-storage-engine=INNODB

datadir=/data/mysql
socket=/data/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

skip-name-resolve
max_connections=512
#key_buffer_size=1024M
back_log = 200
table_cache = 512
thread_concurrency = 16
thread_cache = 128

max_allowed_packet = 128M
max_length_for_sort_data=8388608
read_rnd_buffer_size=64M

query_cache_size=1024M
query_cache_type=2

#wait_timeout=31536000
#interactive_timeout=31536000
wait_timeout=200
interactive_timeout=200

log_slow_queries=/data/mysql/log_slow_queries.log
long_query_time = 1

innodb_buffer_pool_size=5G
innodb_log_file_size=128M
innodb_log_files_in_group=2
innodb_log_buffer_size=3M
innodb_flush_log_at_trx_commit=0
innodb_flush_method=O_DIRECT
#innodb_force_recovery=4

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[client]
default-character-set=utf8
socket=/data/mysql/mysql.sock

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值