跳转至

Mysql 5.6 配置示例


2015-06-17 by dongnan

环境

软件版本: mysql 5.6 源码方式安装
服务器: DELL R620 2CPU/32GB内存/400GB SSD*2/Raid 1

配置文件

cat /etc/my.cnf

[mysqld]
user   = mysql
port   = 3306
socket = /tmp/mysql.sock
basedir  = /usr/local/mysql
datadir  = /usr/local/mysql/data
pid-file = /usr/local/mysql/data/mysql.pid
character_set_server = utf8
skip-name-resolve

# slow_log
long_query_time = 5
slow_query_log  = 1

# connect
max_connections = 2000
max_connect_errors = 1000
max_user_connections = 1000
interactive_timeout = 300
wait_timeout = 300

tmp_table_size = 32M
thread_cache_size = 100
key_buffer_size = 1024M

# innodb
default-storage-engine = INNODB
innodb_flush_log_at_trx_commit = 1
innodb_file_per_table = 1
innodb_buffer_pool_size = 10240M
innodb_log_file_size = 512M

# binlog
#log-bin=mysql-bin
#binlog_format = mixed
#server-id = 11
#sync_binlog = 1
#expire_logs_days = 15

慢查询日志

慢查询日志配置项 slow_query_log = 1 日志保存位置为 安装目录+主机名 例如:

ll /usr/local/mysql/data/localhost-slow.log

-rw-rw---- 1 mysql mysql 175 Jun 12 15:55 /usr/local/mysql/data/localhost-slow.log

欢迎关注微信公众号: 运维录

Back to top