[mysqld]
########basic settings########
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
character-set-server=utf8
back_log = 600 #当达到最大连接数时,可以被存在堆栈中的连接
max_connections=1000 #最大连接数
max_prepared_stmt_count=124000
max_connect_errors = 6000 #对同一主机,超过6000中断错误连接,将禁止连接
lower_case_table_names = 1 #不区分大小写
table_open_cache= 4096 # 每打开一个表,读入缓存的数据大小
table_definition_cache=8192
open_files_limit = 65535 #打开的文件的描述符的限制
max_allowed_packet = 4M #接受的数据包的大小,此为仅当需要时才会分配内存大小
query_cache_limit = 2M #指定单个查询能够使用的缓冲区大小,默认1M
ft_min_word_len = 4 #分词词汇最小长度
transaction_isolation = REPEATABLE-READ #事件隔离级别,此为默认
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
#######log settings########
binlog_cache_size = 1M #一个事件,在没有提交时,产生的日志记录到Cache中的大小
log_bin = /data/mysql-logs/binlog/mysql-bin
binlog_format = mixed
slow_query_log = 1
long_query_time = 1 #慢查询时间 超过1秒则为慢查询
slow_query_log_file = /data/mysql-logs/slow/mysql-slow.log
expire_logs_days = 90 #超过90天的binlog删除
log_queries_not_using_indexes = 1
log_slow_admin_statements = 1
log_slow_slave_statements = 1
min_examined_row_limit = 100
##########InnoDB############
skip-external-locking #MySQL选项以避免外部锁定。该选项默认开启
default-storage-engine = InnoDB #默认存储引擎
innodb_file_per_table = 1 #每个数据库的每个表生成一个数据空间
innodb_open_files = 2000 #限制能够打开的表的数据,默认300
innodb_buffer_pool_size = 64M #使用一个缓冲池来保存索引和原始数据
innodb_thread_concurrency = 0 #默认设置0,表示不限制并发数
innodb_flush_log_at_trx_commit = 2 #每次提交事件都会写入日志
innodb_log_buffer_size = 2M #确定写日志文件所用的内存大小
innodb_log_file_size = 32M #确定数据日志的文件大小
innodb_log_files_in_group = 3 #以循环方式将日志文件写到多个文件
innodb_max_dirty_pages_pct = 90 #主线程刷新缓存池中的数据,使无用数据少于90%
innodb_lock_wait_timeout = 120 #事件在被回滚之前可以等待一个锁定的超时秒数
bulk_insert_buffer_size = 8M #批量插入缓存大小
myisam_sort_buffer_size = 8M #恢复表时使用的缓冲区大小
myisam_max_sort_file_size = 10G #使用快速排序方法来创建一个索引
myisam_repair_threads = 1 #在Repair by sorting过程中创建MyISAM表索引
interactive_timeout = 28800 #服务器关闭交互式连接前等待活动的秒数
wait_timeout = 28800 #服务器关闭非交互连接之前等待活动的秒数
[mysqldump]
quick
max_allowed_packet = 16M #服务器发送和接受的最大包长度
[myisamchk]
key_buffer_size = 8M #指定用于索引的缓冲区大小
sort_buffer_size = 8M #执行排序使用的缓冲大小,增加ORDER BY速度
read_buffer_size = 4M #读入缓存区大小,对表进行扫描请求分配的读入缓冲区
tmp_table_size = 16M #heap(堆积)表缓冲大小
read_rnd_buffer_size = 8M #随机读缓存区大小,对任意顺序查询分配读入缓冲区,用于顺序查询(禁止设置过大,避免消耗内存)
join_buffer_size = 8M #联合查询操作所能使用的缓冲区大小
thread_cache_size = 8 #重新利用保存在缓存中的线程的数量
query_cache_size = 8M #查询缓冲大小
write_buffer = 4M
[mysqld_safe]
log-error=/data/mysql-logs/error/mysql-error.log
pid-file=/var/run/mysqld/mysqld.pid
[client]
default-character-set=utf8
原文出自:一次Linux下卸载安装mysql-5.1.73的折腾 - 零之寒怒 - 博客园 https://www.cnblogs.com/lzhn/p/7808632.html