优化配置如下,可根据各自电脑硬件不同进行调整

# MySQL Server Instance Configuration File
# ----------------------------------------------------------------------
# Generated by the MySQL Server Instance Configuration Wizard
#
#
# Installation Instructions
# ----------------------------------------------------------------------
#
# On Linux you can copy this file to /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options
# (@localstatedir@ for this installation) or to
# ~/.my.cnf to set user-specific options.
#
# On Windows you should keep this file in the installation directory
# of your server (e.g. C:\Program Files\MySQL\MySQL Server X.Y). To
# make sure the server reads the config file use the startup option
# "--defaults-file".
#
# To run run the server from the command line, execute this in a
# command line shell, e.g.
# mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"
#
# To install the server as a Windows service manually, execute this in a
# command line shell, e.g.
# mysqld --install MySQLXY --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"
#
# And then execute this in a command line shell to start the server, e.g.
# net start MySQLXY
#
#
# Guildlines for editing this file
# ----------------------------------------------------------------------
#
# In this file, you can use all long options that the program supports.
# If you want to know the options a program supports, start the program
# with the "--help" option.
#
# More detailed information about the individual options can also be
# found in the manual.
#
#
# CLIENT SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If you want your own MySQL client program to
# honor these values, you need to specify it as an option during the
# MySQL client library initialization.
#
[client]
port=3308
[mysql]
default-character-set=utf8# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this
# file.
#
[mysqld]
# The TCP/IP Port the MySQL Server will listen on
port=3308#Path to installation directory. All paths are usually resolved relative to this.
#basedir="E:/Program Files/MySQL/MySQL Server 5.5/"
basedir="D:/Quarkp2p/mysql-5.6.19-winx64"
#Path to the database root
#datadir="E:/Program Files/MySQL/MySQL Server 5.5/Data/"
datadir="D:/Quarkp2p/mysql-5.6.19-winx64/data"
#log_bin="D:/QuarkP2P/mysql-5.6.19-winx64/log/mysql_bin.log";
# The default character set that will be used when a new schema or table is
# created and no character set is defined
character-set-server=utf8
# The default storage engine that will be used when create new tables when
default-storage-engine=INNODB
# Set the SQL mode to strict
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"#innodb_buffer_pool_size
#+ key_buffer_size
#+ max_connections*(sort_buffer_size+read_buffer_size+binlog_cache_size+thread_stack+join_buffer_size+read_rnd_buffer_size)
#+ max_connections*()
#18432M+8M+3000*(2M+0.125M+0.03125M+0.25M+0.125M+0.25M)= 26.15G
#下面公式可计算配置最大内存消耗
#SELECT
#( @@key_buffer_size + @@query_cache_size + @@tmp_table_size
#+ @@innodb_buffer_pool_size + @@innodb_additional_mem_pool_size
#+ @@innodb_log_buffer_size
#+ @@max_connections * (
#@@read_buffer_size + @@read_rnd_buffer_size + @@sort_buffer_size
#+ @@join_buffer_size + @@binlog_cache_size + @@thread_stack
#) ) /(1024 * 1024 * 1024) AS MAX_MEMORY_GB;#
#
#innodb_buffer_pool_size #+ key_buffer_size #+ max_connections*(sort_buffer_size+read_buffer_size+binlog_cache_size) #+ max_connections*2MB
#连接数  16384为单机最大配置
#show status like 'thread%'; 可查询小贷实际并发并不大,与sort_buffer_size配合使用
#生产连接池 max connection 为1638
max_connections=3000# Sort_Buffer_Size 是一个connection级参数,在每个connection(session)第一次需要使用这个buffer的时候,一次性分配设置的内存。
#Sort_Buffer_Size 并不是越大越好,由于是connection级的参数,过大的设置+高并发可能会耗尽系统内存资源。例如:500个连接将会消耗 500*sort_buffer_size(8M)=4G内存
#Sort_Buffer_Size 超过2KB的时候,就会使用mmap() 而不是 malloc() 来进行内存分配,导致效率降低。
#在 64-bit platforms, >= 5.1.23 时,默认值就是2M
sort_buffer_size = 2M  #打开Qcache对读和写都会带来额外的消耗:
#a、读查询开始之前必须检查是否命中缓存。
#b、如果读查询可以缓存,那么执行完之后会写入缓存。
#c、当向某个表写入数据的时候,必须将这个表所有的缓存设置为失效,如果缓存空间很大,则消耗也会很大,可能使系统僵死一段时间,因为这个操作是靠全局锁操作来保护的。
#不开启查询缓存
#MySQL查询缓存保存查询返回的完整结果。当查询命中该缓存,会立刻返回结果,跳过了解析,优化和执行阶段。
#查询缓存的空间不要设置的太大。
#query_cache_size=256M
#SHOW STATUS LIKE 'Qcache%';  可以看到生产当前虽然配置了大小  但没打开缓存
#query_cache_type=1
#MYSQL默认的table_open_cache为64,这个数值是偏小的,如果max_connections较大,则容易引起性能问题。
# show global status like 'open%tables%'; 发现Opened_tables数值非常大,说明cache太小,导致要频繁地open table
table_open_cache=3000#该参数在面临group by order by 等查询时比较重要,可适当调大,防止生成磁盘临时表
#临时表主要是为了放一些中间大结果集的一些子集,内存表可以放一些经常频繁使用的数据。
#        *  临时表:表建在内存里,数据在内存里
#        *  内存表:表建在磁盘里,数据在内存里
#       临时表和内存表所使用内存大小可以通过My.cnf中的max_heap_table_size、tmp_table_size指定:max_heap_table_size=1024M   #内存表容量
tmp_table_size=1024M             #临时表容量
#       当数据超过临时表的最大值设定时,自动转为磁盘表,此时因需要进行IO操作,性能会大大下降,而
#       内存表不会,内存表满后,则会提示数据满错误。#缓存的线程数 show global status like 'Thread%'; 可查询线程缓存和创建的情况
thread_cache_size=300#show status like  'Innodb_buffer_pool_%';
#innodb缓存池大小  当物理机上只有mysql服务时建议为屋里内存的75%
innodb_buffer_pool_size=20G
#该参数将innodb_buffer_pool划分为不同的instance,每个instance独立的LRU、FLUSH、FREE、独立的mutex控制。适当增大可显著优化性能
innodb_buffer_pool_instances=8
#存放Innodb 的字典信息和其他一些内部结构所需要的内存空间 mysql5.6之后不支持该配置
#innodb_additional_mem_pool_size=20M#下面三条配置的都是mysql redolog的配置  文件默认在data下 ib-logfile
#innodb_log_file_size*innodb_log_files_in_group越大越好,mysql 官方在5.5之前建议不大于4G
innodb_log_file_size=512M
innodb_log_files_in_group=4
innodb_log_buffer_size=8M
#推荐设置为cpu核心数
innodb_thread_concurrency=6
#表示每秒钟IO设备处理数据页的上限,如果硬盘性能比较好,可以设大一些(如1000)。
innodb_io_capacity=500
#设置为1时,可保证数据库崩溃不会丢失数据,但会降低性能,默认1
#设置为0时,有可能会在崩溃会丢失1秒的数据,会提升性能
innodb_flush_log_at_trx_commit=1#binlog配置
server-id = 222
log-bin=mysql-bin
#需要同步的二进制数据库名;
#binlog-do-db=xedk
#不同步的二进制数据库名,如果不设置可以将其注释掉;
#binlog-ignore-db=information_schema
#设定生成的log文件名;
# 注意 需要手动创建 binlog文件夹
log-bin="D:/QuarkP2P/mysql-5.6.19-winx64/binlog/mysql_bin.log"
#把更新的记录写到二进制文件中;
#log-slave-updates
log-bin-trust-function-creators=1#myisam表用到的参数
#myisam_max_sort_file_size=100G#myisam_sort_buffer_size=34M
#Index blocks for MyISAM tables are buffered and are shared by all threads. key_buffer_size is the size of the buffer used for index blocks. The key buffer is also known as the key cache.
#key_buffer_size=250M
#Each thread that does a sequential scan for a MyISAM table allocates a buffer of this size (in bytes) for each table it scans.
#read_buffer_size=64M
#When reading rows from a MyISAM table in sorted order following a key-sorting operation, the rows are read through this buffer to avoid disk seeks
#read_rnd_buffer_size=256M

Mysql-Innodb配置优化相关推荐

  1. MySQL参数配置优化

    MySQL参数配置优化 max_connections Variable Scope:      Global Dynamic Variable:  Yes Default:              ...

  2. MySQL InnoDB配置统计信息

    MySQL InnoDB配置统计信息 配置持久化(Persistent)统计信息参数 配置非持久化(Non-Persistent)统计信息参数 Analyze Table复杂性长度 本文档介绍如何为I ...

  3. Mysql优化系列(1)--Innodb引擎下mysql自身配置优化

    1.简单介绍 InnoDB给MySQL提供了具有提交,回滚和崩溃恢复能力的事务安全(ACID兼容)存储引擎.InnoDB锁定在行级并且也在SELECT语句提供一个Oracle风格一致的非锁定读.这些特 ...

  4. MySQL数据库配置优化

    MySQL参数优化对于不同的网站,及其在线量,访问量,帖子数量,网络情况,以及机器硬件配置都有关系, 优化不可能一次性完成,需要不断的观察以及调试,才有可能得到最佳效果. 下面列出了对性能优化影响较大 ...

  5. Mysql Innodb 引擎优化(-)

    作/译者:吴炳锡,来源:http://imysql.cn & http://imysql.cn/blog/3208 转载请注明作/译者和出处,并且不能用于商业用途,违者必究. 介绍: Inno ...

  6. mysql innodb 设置详解_【mysql】mysql innodb 配置详解

    MySQLinnodb 配置详解 innodb_buffer_pool_size:这是InnoDB最重要的设置,对InnoDB性能有决定性的影响.默认的设置只有8M,所以默认的数据库设置下面InnoD ...

  7. mysql 参数配置优化

    1 数据文件与二进制日志文件确保分别存放在不同的磁盘上,防范磁盘故障 2 设置开启innodb引擎,default-storage-engine=innodb 3 设置innodb_file_per_ ...

  8. mysql数据库配置优化(占cpu过高问题)

    MySQL5.6的my.ini配置 提供一个MySQL 5.6版本适合在1GB内存VPS上的my.cnf配置文件(点击这里下载文件): [client] port = 3306 socket = /t ...

  9. mysql mrr cost based,MySQL InnoDB MRR 优化

    MRR 是 Multi-Range Read 的简写,目的是减少磁盘随机访问,将随机访问转化为较为顺序的访问.适用于 range/ref/eq_ref 类型的查询. 实现原理: 在二级索引查找后,根据 ...

  10. Mysql性能优化、Mysql参数优化、Mysql配置优化

    码字不易,转载请附原链,搬砖繁忙回复不及时见谅,技术交流请加QQ群:909211071 Mysql性能优化.Mysql参数优化.Mysql配置优化.Mysql参数优化对于不同的网站,及在线量等,以及机 ...

最新文章

  1. go 语言 链表 的增删改查
  2. R语言set.seed函数的意义及实战
  3. Kali渗透测试——快速查找Metasploit的模块
  4. 别再乱用 Prometheus 联邦了,分享一个 Prometheus 高可用新方案
  5. 插入透明32位png格式图片支持ie5.5+、 FF、chrome、safari
  6. 使用 matlab 产生GK101任意波数据文件的方法
  7. 博客园今天将排名计算错误了
  8. Please copy/symlink the 'missing image' image at xxx
  9. 获取清空textarea的文字内容_运用|你会做 词云图(文字云) 吗?
  10. flex 组建重写
  11. python中str和input_python中eval()函数和input()函数用法解析
  12. 【小型JavaFx项目】文字小冒险游戏
  13. jquery基础使用!
  14. 微信计步器怎么不计步_微信运动不计步,如何解决
  15. android 圆形自定义进度条,Android 实现自定义圆形进度条的功能
  16. MySql -- 数据库备份工具xtrabackup
  17. android重新启动_如何重新启动Android智能手机或平板电脑
  18. eHIDS 一款基于eBPF的HIDS开源工具
  19. 如何运营高效的社群?
  20. RESB 0x7dfe-$ 报错

热门文章

  1. 来了, 微信又双叒叕更新
  2. 博客优化 搜索SEO优化 提高搜索量
  3. Jenkins安装时Web页面报错:该Jenkins实例似乎已离线
  4. Codeforces Round #809 (Div. 2)。D2. Chopping Carrots (Hard Version)
  5. 假如生活欺骗了你 (俄)普希金
  6. 无法删除文件夹,目录不是空的或U盘文件无法删除的解决办法
  7. 啥是正交实验简单了解
  8. JDK1.6官方下载_JDK6官方下载_JDK1.6API(chm)下载_JDK6APICHM中文参考下载_JDK1.6下载_JDK6下载
  9. SpringCloud Netfilx全家桶+ Alibaba(nacos、sentinel、seata) 快速配置,快速启动
  10. 商务汇报PPT制作的七堂课-第二课:模板制作