Mysql配置文件 4c8g优化
一.说明
以下配置适合4核8G及以下的配置,会让性能稍微提高1/3左右。
测试语句
mysqlslap -uroot -p123456 --concurrency=100 --iterations=30 --auto-generate-sql --auto-generate-sql-load-type=mixed --auto-generate-sql-add-autoincrement --engine=innodb --number-of-queries=5000
没配置
Average number of seconds to run all queries: 0.735 seconds
Minimum number of seconds to run all queries: 0.551 seconds
Maximum number of seconds to run all queries: 1.141 seconds
优化后的
Average number of seconds to run all queries: 0.691 seconds
Minimum number of seconds to run all queries: 0.630 seconds
Maximum number of seconds to run all queries: 0.749 seconds
二.配置
my.cnf
[client]
port = 3306
socket = /usr/local/mysql/mysql.sock
[mysqld]
#基础设置
port = 3306
bind-address = 0.0.0.0
lower_case_table_names=1
character-set-server=utf8mb4
default-storage-engine=innoDB
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
socket=/usr/local/mysql/mysql.sock
log-error=/var/log/mysql/mysql.log
pid-file=/usr/local/mysql/mysql.pid
#扩展设置
max_connections = 1000
max_connect_errors = 6000
connect_timeout=10
wait_timeout = 300
interactive_timeout = 300
back_log = 300
open_files_limit = 65535
table_open_cache = 512
max_allowed_packet = 500M
max_heap_table_size = 8M
tmp_table_size = 64M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
sort_buffer_size = 8M
join_buffer_size = 8M
key_buffer_size = 64M
thread_cache_size = 32
thread_stack = 128K
ft_min_word_len = 1
skip-external-locking
bulk_insert_buffer_size = 8M
myisam_sort_buffer_size = 32M
net_retry_count = 100
auto_increment_increment=0
auto_increment_offset=0
explicit_defaults_for_timestamp=false
log_bin_trust_function_creators=1
performance_schema= 0
transaction-isolation = REPEATABLE-READ
query_cache_size = 0
query_cache_type = 0
#binlog日志
log-bin=mysql-bin
log-bin-index=mysql-bin.index
server-id=1
max_binlog_size = 512M
binlog_format = MIXED
log_slave_updates = 0
expire_logs_days = 7
max_relay_log_size = 512M
binlog-ignore-db = mysql
binlog-ignore-db = test
binlog-ignore-db = information_schema
binlog-ignore-db = performance_schema
replicate-ignore-db = mysql
replicate-ignore-db = test
replicate-ignore-db = information_schema
replicate-ignore-db = performance_schema
binlog_cache_size = 1M
max_binlog_cache_size = 15M
#慢查询
slow_query_log=1
long_query_time=1
log-queries-not-using-indexes = TRUE
log_throttle_queries_not_using_indexes=1000
min_examined_row_limit=1000
log-slow-admin-statements = TRUE
log-slow-admin-statements = TRUE
#innodb引擎
innodb_file_per_table = 1
innodb_open_files = 500
innodb_buffer_pool_size = 512M
innodb_thread_concurrency = 0
innodb_purge_threads = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 2M
innodb_log_file_size = 32M
innodb_max_dirty_pages_pct = 85
innodb_lock_wait_timeout = 120
innodb_flush_method=O_DIRECT
innodb_data_file_path = ibdata1:10M:autoextend
innodb_autoinc_lock_mode = 2
innodb_buffer_pool_dump_at_shutdown = 1
innodb_buffer_pool_load_at_startup = 1
innodb_support_xa = 0
innodb_status_file = 1
Mysql配置文件 4c8g优化的更多相关文章
- Mysql配置文件 16c64g优化
目录 一.说明 二.配置 一.说明 以下配置适合16核64G及以上的配置,会让性能稍微提高1/3左右. 二.配置 my.cnf [client] port = 3306 socket = /usr/l ...
- mysql数据库索引优化
参考 :http://www.cnblogs.com/yangmei123/archive/2016/04/10/5375723.html MySQL数据库的优化: 数据库优化的目的: ...
- 【转】4G内存下MySQL修改配置文件以优化效率(来自discuz)
摘要:公司网站访问量越来越大,MySQL自然成为瓶颈,因此最近我一直在研究 MySQL 的优化,第一步自然想到的是 MySQL 系统参数的优化,作为一个访问量很大的网站(日20万人次以上)的数据库. ...
- (转)MySQL配置文件mysql.ini参数详解、MySQL性能优化
本文转自:http://www.cr173.com/html/18331_1.html my.ini(Linux系统下是my.cnf),当mysql服务器启动时它会读取这个文件,设置相关的运行环境参数 ...
- MySQL配置文件mysql.ini参数详解、MySQL性能优化
my.ini(Linux系统下是my.cnf),当mysql服务器启动时它会读取这个文件,设置相关的运行环境参数. my.ini分为两块:Client Section和Server Section. ...
- Linux中MySQL配置文件my.cnf参数优化
MySQL参数优化这东西不好好研究还是比较难懂的,其实不光是MySQL,大部分程序的参数优化,是很复杂的.MySQL的参数优化也不例外,对于不同的需求,还有硬件的配置,优化不可能又最优选择,只能慢慢的 ...
- MYSQL数据库的优化
我们究竟应该如何对MySQL数据库进行优化?下面我就从MySQL对硬件的选择.MySQL的安装.my.cnf的优化.MySQL如何进行架构设计及数据切分等方面来说明这个问题. 服务器物理硬件的优化 在 ...
- MySQL 调优/优化的 100 个建议
MySQL 调优/优化的 100 个建议 MySQL是一个强大的开源数据库.随着MySQL上的应用越来越多,MySQL逐渐遇到了瓶颈.这里提供 101 条优化 MySQL 的建议.有些技巧适合特定 ...
- MySQL配置文件my.cnf 例子最详细翻译
转的 MySQL配置文件my.cnf 例子最详细翻译,可以保存做笔记用. #BEGIN CONFIG INFO#DESCR: 4GB RAM, 只使用InnoDB, ACID, 少量的连接, 队列负载 ...
随机推荐
- Python 数据类型常用的内置方法(二)
目录 Python 数据类型常用的内置方法(二) 1.字符串类型常用内置方法 1.upper.lower.isupper.islower 2.startswith.endswith 3.format ...
- 菜鸡的Java笔记 第三十四 Annotation
Annotation 多例模式特点: 1. 多例类可以有多个实例 2. 多例类必须自己创建自己的实例,并管理自己的实例,和向外界提供自己的实例 ...
- [noi712]练级
先考虑一个联通块,可以发现这个联通快内不会存在两个偶数的点证明:如果存在,那么这两个点的某一条路径上的边全部反过来,可以使答案+2,即答案为点数或点数-1同时,发现答案的奇数点数一定与边数同奇偶,那么 ...
- Centos8上安装Nginx
一.Nginx下载 官网:http://nginx.org/ 选择稳定版下载:直接右键复制下载地址即可 命令: wget http://nginx.org/download/nginx-1.20.2. ...
- 【2020五校联考NOIP #7】道路扩建
题面传送门 题意: 给出一张 \(n\) 个点 \(m\) 条边的无向图 \(G\),第 \(i\) 条边连接 \(u_i,v_i\) 两个点,权值为 \(w_i\). 你可以进行以下操作一次: 选择 ...
- Codeforces 1290D - Coffee Varieties(分块暴力+完全图的链覆盖)
Easy version:Codeforces 题面传送门 & 洛谷题面传送门 Hard version:Codeforces 题面传送门 & 洛谷题面传送门 发现自己交互题烂得跟 s ...
- 60-Lowest Common Ancestor of a Binary Search Tree
Lowest Common Ancestor of a Binary Search Tree My Submissions QuestionEditorial Solution Total Accep ...
- 23-Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. Examples: Giv ...
- linux系统中安装JDK
安装之前的准备工作 查看系统中之前安装好的JDK java –version rpm -qa | grep java 卸载JDK (以java-1.7.0-openjdk-1.7.0.45-2.4.3 ...
- ache
ache和pain可能没啥差别,头疼和头好痛都对.从词典来看,有backache, bellyache, earache, headache, heartache, moustache/mustach ...