my.cnf内容如下
# For advice on how to change settings please see# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html[client]# password = ...# port = ...# socket = ...default_character_set = utf8[mysqld]basedir = /usr/local/mysqldatadir = /usr/local/mysql/dataport = 3306# server_id = ...user = mysqlsocket = /tmp/mysql.sock# 禁止通过域名方式连接数据库skip_name_resolve# 禁止外部锁定skip-external-locking# 指定用于索引的缓冲区大小,注意该参数设置的过大反而会使服务器整体效率降低key_buffer_size = 384M# 指定接受的数据包大小max_allowed_packet = 16M# 指定打开表缓存数量table_open_cache = 512# 二进制日志binlog-ignore-db = mysqlbinlog-ignore-db = testbinlog-ignore-db = information_schemabinlog-ignore-db = performance_schemalog-bin = mysqlbinbinlog_format = mixedexpire_logs_days = 5# 慢查询日志slow_query_log = 1long_query_time = 2slow_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# 指定单个查询能够使用的缓冲大小,默认1Mquery_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平台中这个参数设置为4innodb_file_io_threads = 4# 采用Barracuda行存储格式可以对表空间启用压缩,仅对InnoDB表生效innodb_file_format = barracudainnodb_file_format_check = on# 每个InnoDB表启用自己独立的表空间innodb_file_per_table = 1# 指定InnoDB内核的并发线程数,设置为0表示不限制并发数innodb_thread_concurrency = 0# 指定InnoDB表空间数据文件名,大小以及其他属性innodb_data_file_path = ibdata1:1G:autoextendinnodb_autoextend_increment = 256 # 单位为M# 指定InnoDB刷写日志的策略,默认为1表示每次提交事务的时候都会将log buffer刷写到日志innodb_flush_log_at_trx_commit = 2[mysqld_safe]log-error = /usr/local/mysql/mysqld.logpid-file = /usr/local/mysql/mysqld.pid[mysqldump]quickmax_allowed_packet = 16M[mysql]no-auto-rehash[myisamchk]read_buffer = 2Mwrite_buffer = 2M[mysqlhotcopy]interactive-timeoutsql_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