---
title: "SSD硬盘下MySQL5.6优化，性能提升进10倍"
author: "linder"
date: "2016-01-14T17:27:19Z"
tags: []
categories: ["数据库"]
slug: "ssd-mysql5-6-10"
draft: false
lastmod: "2016-01-14T17:27:19Z"
id: 2270719
url: "https://linder.iteye.com/blog/2270719"
---

笔记本性能参数如下：

CPU：i7

内存：16G

硬盘：SSD

优化前（默认安装），批量执行1万笔insert耗时11秒，优化后，批量执行1万笔insert耗时1.03秒

测试534万笔insert耗时11分4秒340毫秒，优化后的参数如下，仅供参考。

\[client]

no-beep

port=3306

\[mysql]

default-character-set=utf8

port=3306

datadir=C:/ProgramData/MySQL/MySQL Server 5.6/Data

character-set-server=utf8

default-storage-engine=INNODB

sql-mode="STRICT\_TRANS\_TABLES,NO\_AUTO\_CREATE\_USER,NO\_ENGINE\_SUBSTITUTION"

log-output=FILE

general-log=0

general\_log\_file="LIDINGBO-PC.log"

slow-query-log=1

slow\_query\_log\_file="LIDINGBO-PC-slow.log"

long\_query\_time=10

log-error="LIDINGBO-PC.err"

server-id=1

max\_connections=151

query\_cache\_size=128M

table\_open\_cache=128

tmp\_table\_size=512M

thread\_cache\_size=1024

myisam\_max\_sort\_file\_size=100G

myisam\_sort\_buffer\_size=213M

key\_buffer\_size=1024M

read\_buffer\_size=8M

read\_rnd\_buffer\_size=8M

sort\_buffer\_size=256K

innodb\_additional\_mem\_pool\_size=16M

innodb\_flush\_log\_at\_trx\_commit=2

innodb\_log\_buffer\_size=8M

innodb\_buffer\_pool\_size=712M

innodb\_log\_file\_size=48M

innodb\_thread\_concurrency=17

innodb\_autoextend\_increment=64

innodb\_buffer\_pool\_instances=8

innodb\_concurrency\_tickets=5000

innodb\_old\_blocks\_time=1000

innodb\_open\_files=300

innodb\_stats\_on\_metadata=0

innodb\_file\_per\_table=1

innodb\_checksum\_algorithm=0

back\_log=1024

flush\_time=0

join\_buffer\_size=1024M

max\_allowed\_packet=4M

max\_connect\_errors=100

open\_files\_limit=4161

query\_cache\_type=1

sort\_buffer\_size=8M

table\_definition\_cache=1400

binlog\_row\_event\_max\_size=8K

sync\_master\_info=10000

sync\_relay\_log=10000

sync\_relay\_log\_info=10000

innodb\_buffer\_pool\_size=1G

innodb\_log\_file\_size=512M

innodb\_io\_capacity=2000

innodb\_max\_dirty\_pages\_pct=40

innodb\_adaptive\_flushing=ON

innodb\_write\_io\_threads=4

innodb\_read\_io\_threads=4

innodb\_flush\_neighbors=0

innodb\_file\_io\_threads=4

innodb\_io\_capacity\_max=6000

innodb\_lru\_scan\_depth=2000

innodb\_autoinc\_lock\_mode=2

thread\_stack=256k

max\_heap\_table\_size=256M

binlog\_cache\_size=2M