Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

MySql Optimization - Please help

Discussion in 'Workarounds and Optimization' started by nicolass, Jan 22, 2012.

  1. nicolass

    nicolass Member

    Joined:
    Jan 22, 2012
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    51
    cPanel Access Level:
    Website Owner
    Hi,
    I have almost every day problem with error "Error establishing database connection".

    This is my spec:

    Intel(R) Xeon(R) CPU X3353 @ 2.66GHz
    Memory for crash kernel (0x0 to 0x0) notwithin permissible range
    Memory: 4140432k/4980736k available (2187k kernel code, 47024k reserved, 906k data, 232k init, 3271296k highmem)

    WHM 11.30.5 (build 6)
    CENTOS 5.7 i686 standard on server

    this is from my.cnf

    [mysqld]
    max_connections=1000
    safe-show-database
    skip-innodb
    old_passwords=1
    query_cache_limit=8M
    #query_cache_limit=20M
    query_cache_size=128M
    #query_cache_size=400M
    query_cache_type=1
    set-variable=interactive_timeout=10
    set-variable=wait_timeout=180
    set-variable=connect_timeout=20
    set-variable=thread_cache_size=32
    set-variable=key_buffer=850M
    #set-variable=key_buffer=1100M
    set-variable=max_allowed_packet=16M
    set-variable=table_cache=2048
    #set-variable=sort_buffer=16M
    #set-variable=sort_buffer=20M
    set-variable=record_buffer=8M
    #set-variable=thread_cache=32
    set-variable=thread_cache=128
    set-variable=thread_concurrency=8
    set-variable=myisam_sort_buffer_size=64M
    max_user_connections=15
    open-files-limit=3000
    join_buffer_size=128K
    tmp_table_size=32M
    #long_query_time=1
    #log-slow-queries=1

    # tweak
    set-variable=read_rnd_buffer_size=4M
    max_heap_table_size=33554432
    log-slow-queries
    log-queries-not-using-indexes
    # tweak end

    [myisamchk]
    set-variable=key_buffer=256M
    set-variable=sort_buffer=256M
    set-variable=read_buffer=2M
    set-variable=write_buffer=2M

    [mysqld_safe]
    err-log=/var/log/mysqld.log
    open_files_limit=8192


    I have traffic around 30K Unique visitors.
    Sites are mainly inage galleries run on Wordpress.

    I tried many things with optimization of queries etc..but nothing

    any suggestion?
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,608
    Likes Received:
    32
    Trophy Points:
    238
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Do you have any errors in the MySQL error log when you are getting "Error establishing database connection" on site(s)? The error log is typically at /var/lib/mysql/hostname.err location where hostname is the fully qualified hostname of the machine (you can obtain the server's hostname using the "hostname -f" command).

    There's little point to optimize yet until you've reviewed the error logs, since it might be an issue with /tmp space or some specific database that is causing the problem.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice