企业百万级myql的配置文件my.cnf

[client]

port=3306

socket=/tmp/mysql.sock

[mysqld]

user=mysql

server_id=10

port=3306          -----指定MySQL监听端口

socket=/tmp/mysql.sock   -----socket通信设置

datadir=/data/mysql     -----指定数据库的目录

old_passwords=1

lower_case_tabel_names=1

character-set-server=utf8

default-storage-engine=MYISAM

log-bin=bin.log     ----开启bin-log日志并指定名称为bin.log

log-error=error.log

pid-file=mysql.pid

long_query_time=2   --------慢查询超时时间,默认为10s,mysql5.5以上可以设置微秒

slow_query_log    -------关闭慢查询日志

slow_query_log_file=slow.log    --------指定慢查询日志文件

binlog_cache_size=4MB

binlog_format=mixed

max_binlog_cache_size=16MB

max_binlog_size=1GB

expire_logs_days=30

ft_min_word_len=4

back_log=512

max_allowed_packet=64MB  服务器和客户端发送的最大数据包

max_connections=4096

max_connect_errors=100

join_buffer_size=2MB     ------经常会出现一些两表(或多表)Join的操作需求

read_buffer_size=2MB    - ----顺序读取数据缓冲区使用内存

read_rnd_buffer_size=2MB    -----随机读取数据缓冲区使用内存

sort_buffer_size=64MB         ----排序区缓存大小

query_cache_size=64MB     ----指定MySQL查询结构缓冲区的大小

table_open_cache=10000     -------表缓存

thread_cache_size=256       -----连接线程缓存

max_heap_table_size=64MB    -----存储引擎表的最大容量

tmp_table_size=64MB    ------临时表使用内存

thread_stack=192KB

thread_concurrency=24

local-infile=0

skip-show-database

skip-name-resolve

skip-external-locking

connect-timeout=600

interactive_timeout=600

wait_timeout=600

#***MyISAM

key_buffer_size=512MB         -------MyISAM索引缓存

bulk_insert_buffer_size=64MB       ------批量插入暂存使用内存

mysiam_sort_buffer_size=64MB

myisam_max_sort_file_size=64MB

myisam_repair_threads=1

concurrent_insert=2

myisam_recover

#**INNODB

innodb_buffer_pool_size=64MB        ------数据和索引缓存       

innodb_additional_mem_pool_size=32MB

innodb_data_file_path=ibdata1:1G;ibdata2:1G:autoextend

innodb_read_io_threads=8

innodb_write_io_threads=8

innodb_file_per_table=1

innodb_flush_log_at_trx_commit=2

innodb_lock_wait_timeout=120

innodb_log_buffer_size=8MB     ------InnoDB 日志缓冲区

innodb_log_file_size=256MB

innodb_log_files_in_group=3

innodb_max_dirty_pages_pct=90

innodb_thread_concurrency=16

innodb_open_files=10000

#innodb_force_recovery=4

#***Replication Slave

read-only

#skip-slave-start

relay-log=relay.log

log-slave-updates

猜你喜欢

转载自blog.csdn.net/zhydream77/article/details/81265123