MySQL 线上配置文件

第一个配置

[client]
port            = 3306
socket          = /tmp/mysql.sock
default-character-set = utf8
[mysqld]
default-character-set = utf8
user = mysql
port            = 3306
socket          = /tmp/mysql.sock
basedir = /usr/local/mysql
datadir = /data/mysql/data
log-error = /data/mysql/mysql-error.log
pid-file = /data/mysql/mysql.pid
ft_min_word_len = 1
old-passwords = 1
log_slave_updates = 1
log-bin = /data/mysql/binlog/mysql-bin
binlog_format = mixed
binlog_cache_size = 4M
max_binlog_cache_size = 8M
max_binlog_size = 1G
expire_logs_days = 90
binlog-ignore-db = mysql
binlog-ignore-db = test
binlog-ignore-db = information_schema
key_buffer_size = 384M
read_buffer_size = 4M
read_rnd_buffer_size = 16M
sort_buffer_size = 8M
join_buffer_size = 8M
thread_cache_size = 8
query_cache_size = 32M
query_cache_limit = 2M
query_cache_min_res_unit = 2k
thread_concurrency = 8
table_cache = 614
table_open_cache = 512
open-files-limit = 10240
back_log = 600
max_connections = 5000
max_connect_errors = 6000
external-locking = FALSE
max_allowed_packet = 16M
default-storage-engine = MYISAM
thread_stack = 256K
transaction_isolation = REPEATABLE-READ
tmp_table_size = 256M
max_heap_table_size = 512M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 64M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover
long_query_time = 2
slow_query_log
slow_query_log_file = /data/mysql/slow.log
skip-locking
skip-name-resolve
server-id = 1
innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_size = 512M
innodb_data_file_path = ibdata1:10M:autoextend
innodb_file_io_threads = 4
innodb_thread_concurrency = 8
innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 16M
innodb_log_file_size = 128M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_file_per_table = 0
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
Remove the next comment character if you are not familiar with SQL
safe-updates
[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout

第二个配置

[client]
port		= 5660
socket		= /tmp/mysql5660.sock
character_set_server = utf8
[mysqld]
port		= 5660
socket		= /tmp/mysql5660.sock
user		= mysql
datadir		= /u2/mysql5660/data
back_log = 500
#skip-networking
#skip-grant-tables
character_set_server = utf8
max_connections = 300
#max_user_connections = 1000

gtid_mode=on
enforce-gtid-consistency=1

explicit_defaults_for_timestamp = 1
thread_handling=pool-of-threads
thread_pool_oversubscribe=25

#percona
#innodb_recovery_update_relay_log=1

skip_name_resolve=1

max_connect_errors = 10240
table_open_cache = 2048
max_allowed_packet = 16M

binlog_cache_size = 1M

max_heap_table_size = 64M
read_buffer_size = 512k

read_rnd_buffer_size = 16M
sort_buffer_size = 512k
join_buffer_size = 512k
thread_cache_size = 64

thread_concurrency = 32
query_cache_size = 0

#query_cache_limit = 2M

#ft_min_word_len = 4

#memlock

thread_stack = 192K

# READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ, SERIALIZABLE
transaction_isolation = READ-COMMITTED

tmp_table_size = 64M

log-bin=/u2/mysql5660/logs/mysql-bin
max_binlog_size=256M
binlog_format=mixed

log_slave_updates

#log
log_error = /u2/mysql5660/data/error.log
log_warnings
slow_query_log
#slow_query_log=/u2/mysql5660/data/slow.log

long_query_time = 1

tmpdir = /u2/mysql5660/tmp

server-id = 115660


key_buffer_size = 64M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G

myisam_repair_threads = 1

myisam-recover-options

# *** INNODB Specific options ***


#innodb_additional_mem_pool_size = 16M

innodb_buffer_pool_size = 2G

innodb_data_file_path = ibdata1:100M:autoextend

innodb_data_home_dir =/u2/mysql5660/data
innodb_file_per_table=1

innodb_write_io_threads = 16
innodb_read_io_threads = 16

#innodb_force_recovery=1

innodb_thread_concurrency = 0

innodb_flush_log_at_trx_commit = 0

#innodb_fast_shutdown

innodb_log_buffer_size = 16M

innodb_log_file_size = 256M

innodb_log_files_in_group = 3

innodb_log_group_home_dir=/u2/mysql5660/data

innodb_max_dirty_pages_pct = 90

innodb_flush_method=O_DIRECT

innodb_lock_wait_timeout = 10


[mysqldump]
quick

max_allowed_packet = 16M

[mysql]
no-auto-rehash

# Only allow UPDATEs and DELETEs that use keys.
#safe-updates

[myisamchk]
key_buffer_size = 512M
sort_buffer_size = 512M
read_buffer = 8M
write_buffer = 8M

[mysqlhotcopy]
interactive-timeout

[mysqld_safe]
# Increase the amount of open files allowed per process. Warning: Make
# sure you have set the global system limit high enough! The high value
# is required for a large number of opened tables
open-files-limit = 8192



本文出自 “郑彦生” 博客,请务必保留此出处http://467754239.blog.51cto.com/4878013/1544945

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。