欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

数据库配置优化

程序员文章站 2022-07-12 22:08:52
...
存储引擎主要是:innodb,计划提供2G内存用于Mysql运行

配置文件
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 512
sort_buffer_size = 16M
net_buffer_length = 8K
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 16M
query_cache_size = 32M
query_cache_type = 1                                                                                                                                           
max_connections = 1024                                                                                                                                         
expire_logs_days = 10                                                                                                                                          
max_binlog_size= 256M                                                                                                                                          
long_query_time=1                                                                                                                                              
slow_query_log=1 

#innodb_data_home_dir = /usr/local/mysql/data
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /usr/local/mysql/data
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 1G
innodb_additional_mem_pool_size = 128M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 256M
innodb_log_buffer_size = 8M
#修改此参数,可以大幅度提高数据库性能
innodb_flush_log_at_trx_commit = 2                                                                                                                                          


#innodb_max_dirty_pages_pct = 90                                                                             
#innodb_lock_wait_timeout = 120