/etc/my.cnf 参考配置:
[mysqld]
#skip-grant-tables
#default-character-set=utf8
#character-set-server=utf8
port= 3306
skip-external-locking
key_buffer_size = 16K
basedir=/usr/local/var/mysql
datadir=/usr/local/var/mysql/data
log-error=/usr/local/var/mysql/log/error.log
pid-file=/usr/local/var/mysql/localhost.localdomain.pid
socket=/usr/local/var/mysql/mysql.sock
#binlog_format = mixed
binlog_format = statement
log-bin = /var/lib/mysql/mybinlog
server-id = 2
#慢查询日志:
slow_query_log=off|on #是否开启慢查询日志
slow_query_log_file=filename #指定保存路径及文件名,默认为数据文件目录,hostname-slow.log
long_query_time=2 #指定多少秒返回查询的结果为慢查询
long-queries-not-using-indexes #记录所有没有使用到索引的查询语句
min_examined_row_limit=1000 #记录那些由于查找了多余1000次而引发的慢查询
long-slow-admin-statements #记录那些慢的optimize table,analyze table和alter table语句
log-slow-Slave-statements #记录由Slave所产生的慢查询
#binlog复制配置:
binlog_format = MIXED #binlog日志格式,mysql默认采用statement,建议使用mixed
log-bin = /data/mysql/mysql-bin.log #binlog日志文件
expire_logs_days = 7 #binlog过期清理时间
max_binlog_size = 100m #binlog每个日志文件大小
binlog_cache_size = 4m #binlog缓存大小
max_binlog_cache_size = 512m #最大binlog缓存大小