Proper my.cnf on a 4gb Server

Discussion in 'MySQL' started by Nextron, Aug 22, 2010.

  1. #1
    I seem to be running into mysql out of memory errors every now and then. So I've been tweaking mysql to buffer more ram to prevent this issue.
    With this config, I seem to still get Error 12 1030 still randomly. Most sites on the server are using vbulletin.

    I have 4gb of ram total on my dedi. And willing to give around 1gb to 1.5gb to just mysql.
    What should be tweaked on my my.cnf to ensure proper utilization of that memory.

    [mysqld]
    #datadir=/var/lib/mysql
    datadir=/backup/mysqldata
    #socket=/var/lib/mysql/mysql.sock
    socket=/backup/mysqldata/mysql.sock
    
    #basedir=/var/lib
    #basedir=/backup
    
    #general_log = 1
    #general_log_file = mysql.log
    #log_output = FILE
    
    #skip-name-resolve
    safe-show-database
    local-infile=0
    back_log = 50
    skip-innodb
    max_connections = 500
    key_buffer_size = 1024M
    myisam_sort_buffer_size = 256M
    join_buffer_size = 1M
    read_buffer_size = 1M
    sort_buffer_size = 2M
    table_cache = 8000
    thread_cache_size = 5M
    wait_timeout = 30
    connect_timeout = 10
    tmp_table_size = 100M
    max_heap_table_size = 64M
    max_allowed_packet = 64M
    net_buffer_length = 16384
    max_connect_errors = 100000
    thread_concurrency = 8
    concurrent_insert = 2
    table_lock_wait_timeout = 30
    read_rnd_buffer_size = 786432
    bulk_insert_buffer_size = 8M
    query_cache_limit = 20M
    query_cache_size = 800M
    query_cache_type = 1
    query_prealloc_size = 5M
    query_alloc_block_size = 65536
    transaction_alloc_block_size = 8192
    transaction_prealloc_size = 4096
    default-storage-engine = MyISAM
    max_write_lock_count = 4
    
    [mysqld_safe]
    nice = -10
    open_files_limit = 8192
    
    [mysqldump]
    quick
    max_allowed_packet = 64M
    
    [myisamchk]
    key_buffer = 256M
    sort_buffer = 16M
    read_buffer = 16M
    write_buffer = 16M
    
    
    Code (markup):
    Thanks to anyone who may know!
     
    Nextron, Aug 22, 2010 IP
  2. aroel

    aroel Well-Known Member

    Messages:
    154
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    125
    #2
    have you tried mysqltuner.pl?
     
    aroel, Aug 22, 2010 IP
  3. anands

    anands Well-Known Member

    Messages:
    436
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    120
    #3
    Even i would recommend mysqltuner.pl
    What website are running, if the content aren't updated very frequently, you can implement cache system like eaccelerator to boost your site's performance.
     
    anands, Aug 22, 2010 IP