一文看懂mysql数据库配置参数优化(mysql workbench使用教程图解

生活常识 2023-05-15 11:59生活常识www.xinxueguanw.cn

英特尔至强e5620处理器怎么样 MySQL 数据库优化方案及参数详解(值得收藏)(下)

配置文件优化(根据实际情况优化)

说明,上文中我对my-innodb-heavy-4G.cnf中默认的所有选项进行了说明,下面我就根据我们公司的实际情况进行优化!

1. 的运行环境

硬件服务器:Dell R710,双至强E5620 CPU、16G内存、6*500G硬盘

操作系统: 5.5 X86_64 系统

版本:MySQL 5.5.32

适用于:日IP 100-200W ,日PV 200-500W 的站点

2.具体优化配置如下

[client] port = 3306 socket = /tmp/mysql.sockdefault-character-set = utf8 #设置客户端的字符编码[mysqld]# generic configuration options port = 3306 socket = /tmp/mysql.sock#*** char set ***character-set-server = utf8 #设置服务器端的字符编码 #*** network ***back_log = 512#skip-networking #默认没有开启max_connections = 3000max_connect_errors = 30table_open_cache = 4096#external-locking #默认没有开启max_allowed_packet = 32Mmax_heap_table_size = 128M # *** global cache ***read_buffer_size = 8Mread_rnd_buffer_size = 64Msort_buffer_size = 16Mjoin_buffer_size = 16M # *** thread ***thread_cache_size = 16thread_concurrency = 8thread_stack = 512K # *** query cache ***query_cache_size = 128Mquery_cache_limit = 4M # *** index ***ft_min_word_len = 8 #memlock #默认没有开启default-storage-engine = INNODBtransaction_isolation = REPEATABLE-READ # *** tmp table ***tmp_table_size = 64M # *** bin log ***log-bin=mysql-binbinlog_cache_size = 4Mbinlog_format=mixed#log_slave_updates #默认没有开启#log #默认没有开启,此处是查询日志,开启会影响服务器性能log_warnings #开启警告日志 # *** slow query log ***slow_query_loglong_query_time = 10# *** Replication related settingsserver-id = 1#server-id = 2 #master-host = #master-user = #master-password = #master-port = #read_only#*** MyISAM Specific optionskey_buffer_size = 128Mbulk_insert_buffer_size = 256Mmyisam_sort_buffer_size = 256Mmyisam_max_sort_file_size = 10Gmyisam_repair_threads = 1myisam_recover # *** INNODB Specific options ***#skip-innodb #默认没有开启innodb_additional_mem_pool_size = 64Minnodb_buffer_pool_size = 6G #注意在32位系统上你每个进程可能被限制在 2-3.5G 用户层面内存限制, 所以不要设置的太高.innodb_data_file_path = ibdata1:10M:autoextend#innodb_data_home_dir = innodb_write_io_threads = 8 innodb_read_io_threads = 8#innodb_force_recovery=1innodb_thread_concurrency = 16innodb_flush_log_at_trx_commit = 2#说明:innodb_flush_log_at_trx_commit = 2 如果是游戏服务器,建议此值设置为2;如果是对数据安全要求极高的应用,建议设置为1;设置为0性能更高,但如果发生故障,数据可能会有丢失的危险!默认值1的意思是每一次事务提交或事务外的指令都需要把日志写入(flush)硬盘,这是很费时的。特别是使用电池供电缓存(Battery backed up cache)时。设成2对于很多运用,特别是从MyISAM表转过来的是可以的,它的意思是不写入硬盘而是写入系统缓存。日志仍然会每秒flush到硬盘,所以你一般不会丢失超过1-2秒的更新。设成0会更快一点,但安全方面比较差,即使MySQL挂了也可能会丢失事务的数据。而值2只会在整个操作系统挂了时才可能丢数据。#innodb_fast_shutdowninnodb_log_buffer_size = 16Minnodb_log_file_size = 512Minnodb_log_files_in_group = 3#innodb_log_group_home_dirinnodb_max_dirty_pages_pct = 90#innodb_flush_method=O_DSYNCinnodb_lock_wait_timeout = 120[mysqldump] quickmax_allowed_packet = 32M[mysql] no-auto-rehash[myisamchk] key_buffer_size = 2048M sort_buffer_size = 2048M read_buffer = 32M write_buffer = 32M[mysqlhotcopy] interactive-timeout[mysqld_safe] open-files-limit = 10240

mysql workbench使用教程图解 lost connection to mysql

Copyright@2015-2025 www.xinxueguanw.cn 心血管健康网版板所有