mysql优化配置文件

发布时间: 2023-11-21 12:32 阅读: 文章来源:1MUMB3814PS

最近在对mysql优化,优化配置文件为/etc/my.cnf,详细配置参数如下,供参考

[client]

port = 3306

socket = /tmp/mysql.sock

[mysqld]

user = mysql

server_id = 10

port = 3306

socket = /tmp/mysql.sock

datadir = /usr/local/mysql/var

old_passwords = 1

lower_case_table_names = 1

character-set-server = utf8

default-storage-engine=MyISAM

log-bin = bin.log

log-error = error.log

pid-file = mysql.pid

long_query_time = 2

slow_query_log

slow_query_log_file = slow.log

binlog_cahe_size = 4M

binlog_format = mixed

max_binlog_size = 1G

expire_logs_days = 30

ft_min_word_len = 4

back_log = 512

max_allowed_packet = 64M

max_connections = 4096

max_connect_errors = 100

join_buffer_size = 2M

read_buffer_size = 2M

read_rnd_buffer_size = 2M

sort_buffer_size = 2M

query_cache_size = 64M

table_open_cache= 10000

thread_cache_size = 256

max_heap_table_size = 64M

thread_stack = 192k

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 = 512M

bulk_insert_buffer_size = 64M

myisam_sort_buffer_size = 64M

myisam_max_sort_file_size = 1G

myisam_repair_threads = 1

concurrent_insert = 2

myisam_recover

#*** INNODB

innodb_buffer_pool_size = 16G

innodb_additional_mem_pool_size = 32M

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 = 8M

innodb_log_file_size = 256M

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

有什么错误,大家可以在下面留言指正

•••展开全文