CentOS6 下MySQL option file
时间:2021-07-01 10:21:17
帮助过:3人阅读
//dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
[client]
# password =
...
# port =
...
# socket =
...
default_character_set =
utf8
[mysqld]
basedir = /usr/local/
mysql
datadir = /usr/local/mysql/
data
port =
3306
# server_id =
...
user =
mysql
socket = /tmp/
mysql.sock
# 禁止通过域名方式连接数据库
skip_name_resolve
# 禁止外部锁定
skip-external-
locking
# 指定用于索引的缓冲区大小,注意该参数设置的过大反而会使服务器整体效率降低
key_buffer_size =
384M
# 指定接受的数据包大小
max_allowed_packet =
16M
# 指定打开表缓存数量
table_open_cache =
512
# 二进制日志
binlog-ignore-db =
mysql
binlog-ignore-db =
test
binlog-ignore-db =
information_schema
binlog-ignore-db =
performance_schema
log-bin =
mysqlbin
binlog_format =
mixed
expire_logs_days =
5
# 慢查询日志
slow_query_log =
1
long_query_time =
2
slow_query_log_file = /usr/local/mysql/
slowqueries.log
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size =
128M
# sort_buffer_size =
2M
# read_buffer_size =
2M
# read_rnd_buffer_size =
8M
# 指定TIMESTAMP数据类型的默认行为
explicit_defaults_for_timestamp =
1
# 指定排序MyISAM索引时分配的缓冲区大小
myisam_sort_buffer_size =
64M
# 指定可以重新利用的保存在缓存中的线程数量
thread_cache_size =
8
# 指定查询缓冲大小
query_cache_size =
32M
# 指定单个查询能够使用的缓冲大小,默认1M
query_cache_limit =
16M
# 指定最大连接数
max_connections =
1000
# 指定批量插入缓存大小(针对MyISAM)
bulk_insert_buffer_size =
128M
# 指定InnoDB索引和数据缓存池大小
innodb_buffer_pool_size =
1G
# 指定InnoDB日志文件大小
innodb_log_file_size =
512M
# 指定InnoDB表可用的文件I/
O线程数,建议在非Windows平台中这个参数设置为4
innodb_file_io_threads =
4
# 采用Barracuda行存储格式可以对表空间启用压缩,仅对InnoDB表生效
innodb_file_format =
barracuda
innodb_file_format_check =
on
# 每个InnoDB表启用自己独立的表空间
innodb_file_per_table =
1
# 指定InnoDB内核的并发线程数,设置为0表示不限制并发数
innodb_thread_concurrency =
0
# 指定InnoDB表空间数据文件名,大小以及其他属性
innodb_data_file_path =
ibdata1:1G:autoextend
innodb_autoextend_increment =
256 # 单位为M
# 指定InnoDB刷写日志的策略,默认为1表示每次提交事务的时候都会将log buffer刷写到日志
innodb_flush_log_at_trx_commit =
2
[mysqld_safe]
log-error = /usr/local/mysql/
mysqld.log
pid-
file = /usr/local/mysql/
mysqld.pid
[mysqldump]
quick
max_allowed_packet =
16M
[mysql]
no-auto-
rehash
[myisamchk]
read_buffer =
2M
write_buffer =
2M
[mysqlhotcopy]
interactive-
timeout
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
注:
1)在安装MySQL的过程中,最好先配置好my.cnf,然后再运行初始化配置脚本(scripts/mysql_install_db)。不然会导致一些问题,一些Warning的解决方法参考:
http://my.oschina.net/panzhc/blog/207292
http://blog.itpub.net/14184018/viewspace-1061224/
2)MySQL 5.6的配置选项参考 https://dev.mysql.com/doc/refman/5.6/en/server-options.html
CentOS6 下MySQL option file
标签: