MySQL конфиг my.cnf для сервера с 4-8гб озу.

Может кому пригодится, выкладываю свой базовый конфиг под сервер (шаред хостинг) с 4-8гб озу.
(c)http://linuxguru.ru/administration/mysql-konfig-dlya-servera-s-4-8gb-oz…

# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
 
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
 
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
 
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/english
skip-external-locking
skip-name-resolve
low-priority-updates
bind-address = 127.0.0.1
 
#Tuning
key_buffer              = 1200M
thread_stack            = 512K
thread_cache_size     = 32
table_cache             = 60000
thread_concurrency      = 12
net_buffer_length       = 32
 
myisam-recover     = BACKUP
query_cache_limit       = 2M
query_cache_size        = 256M
 
myisam_sort_buffer_size = 256M
tmp_table_size          = 256M
max_heap_table_size     = 128M
 
read_buffer_size        = 2M
read_rnd_buffer_size    = 4M
 
sort_buffer_size        = 2M
join_buffer_size        = 4M
 
max_allowed_packet     = 256M
max_sort_length         = 512
max_connections         = 120
max_connect_errors      = 50
max_user_connections    = 25
 
 
#general_log_file               = /var/log/mysql/mysql.log
#general_log                    = 1
 
log_slow_queries             = /var/log/mysql/mysql-slow.log
long_query_time = 1
 
#server-id                 = 1
#log_bin             = /var/log/mysql/mysql-bin.log
expire_logs_days             = 10
max_binlog_size                 = 300M
innodb_buffer_pool_size         = 64M
innodb_additional_mem_pool_size = 32M
innodb_file_io_threads          = 8
innodb_lock_wait_timeout        = 50
innodb_log_buffer_size          = 8M
innodb_flush_log_at_trx_commit  = 2
innodb_flush_method             = O_DIRECT
transaction-isolation           = READ-COMMITTED
 
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
 
[mysqldump]
quick
quote-names
max_allowed_packet = 256M
 
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
 
[isamchk]
key_buffer = 32M
 
!includedir /etc/mysql/conf.d/
######################end##############################################

Основные моменты key_buffer max_connections делайте под свою систему, key_buffer не ставьте больше чем 1/3 озу и не больше объема всех б.д.

Для тех кто в танке конфиг в debian лежит в /etc/mysql/my.cnf

перезапустить службу
# services mysql restart
или
# /etc/init.d/mysql restart

Коментувати

Простий текст

  • Не дозволено жодних HTML теґів.
  • Рядки й абзаци переносяться автоматично.
  • Адреси вебсторінок та адреси електронної пошти автоматично перетворюються у посилання.