The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

my.cnf

Discussion in 'Workarounds and Optimization' started by deadend, Mar 30, 2010.

  1. deadend

    deadend Active Member

    Joined:
    Jan 18, 2007
    Messages:
    30
    Likes Received:
    0
    Trophy Points:
    6
    Hi Guys,

    I have not been in the circle for some time and am looking to see if anyone has a nice detailed my.cnf they wouldn't mind sharing.

    This would be used for a shared server, so anything you guys have been using as of late that leaves a good amount of resources per account while not killing the server would be greatly appreciated.

    MySQL v5.1.X

    Thanks!
     
  2. thewebhosting

    thewebhosting Well-Known Member

    Joined:
    May 9, 2008
    Messages:
    1,201
    Likes Received:
    1
    Trophy Points:
    38
  3. Vinu007

    Vinu007 Member

    Joined:
    Aug 9, 2006
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    0
    Hello,

    This should give you an idea how my.cnf file should be.
    Copy paste and edit accordingly
    Quote:


    [mysqld]
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    skip-locking
    #skip-networking
    safe-show-database
    query_cache_limit=1M
    query_cache_size=64M ## 32MB for every 1GB of RAM
    query_cache_type=1
    max_user_connections=200
    max_connections=500
    interactive_timeout=10
    wait_timeout=20
    connect_timeout=20
    thread_cache_size=128
    key_buffer=128M ## 64MB for every 1GB of RAM
    join_buffer=1M
    max_connect_errors=20
    max_allowed_packet=16M
    table_cache=1024
    record_buffer=1M
    sort_buffer_size=2M ## 1MB for every 1GB of RAM
    read_buffer_size=2M ## 1MB for every 1GB of RAM
    read_rnd_buffer_size=2M ## 1MB for every 1GB of RAM
    thread_concurrency=2 ## Number of CPUs x 2
    myisam_sort_buffer_size=64M
    server-id=1
    log_slow_queries=/var/log/mysql-slow-queries.log
    long_query_time=2
    collation-server=latin1_general_ci
    old-passwords
    [mysql.server]
    user=mysql
    basedir=/var/lib
    [safe_mysqld]
    err-log=/var/log/mysqld.log
    pid-file=/var/lib/mysql/mysql.pid
    open_files_limit=8192
    [mysqldump]
    quick
    max_allowed_packet=16M
    [mysql]
    no-auto-rehash
    #safe-updates
    [isamchk]
    key_buffer=32M
    sort_buffer=32M
    read_buffer=16M
    write_buffer=16M
    [myisamchk]
    key_buffer=32M
    sort_buffer=32M
    read_buffer=16M
    write_buffer=16M
    [mysqlhotcopy]
    interactive-timeout


    PS. This is the general setup. Should work with most of the server setup.
     
  4. MikeDVB

    MikeDVB Well-Known Member
    PartnerNOC

    Joined:
    Jun 4, 2008
    Messages:
    212
    Likes Received:
    3
    Trophy Points:
    18
    Location:
    Indiana, USA
    It really depends on what type of sites are on the server and how heavy they are. Some servers we've optimized differently than others for performance just due to the type of work the clients are putting on MySQL.

    It can also vary greatly by the available system ram as I wouldn't apply an optimization designed for a server with 12GB RAM to a server with only 1~4GB Ram.
     
  5. yashraj

    yashraj Member

    Joined:
    Nov 16, 2008
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    United states
    You can use my.cnf file as mentioned by Vinu007, however you should insert your own parameters according to your server resources.
     
Loading...

Share This Page