Results 1 to 15 of 15
  1. #1
    Join Date
    Apr 2006
    Posts
    516

    MySQL keeps down (Cpanel Server)

    I have a Cpanel server with a problem: SQL keeps failing

    Everytime I try to restart MySQL via WHM, it gives me:

    /usr/bin/mysqladmin: connect to server at 'localhost' failed error: 'Can't
    connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)'
    Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock'
    exists! mysql has failed, please contact the sysadmin (result was "mysql
    has failed").

    I can only restart it successfully after 2nd attempt. Server load is always low. Memory usage is also low.

    It happens in very short interval (in less than every 1-10 minutes)

    It never happens until recently when my server management company tweak something I didn't know. They said fixed it and then it happens again every minutes. It's simply pissing me off.

    I have 9 servers and it never happens to the rest 8 servers. Just this server always happening.

    How do I solve this problem? And what exactly is the problem?

  2. #2
    Join Date
    Apr 2006
    Posts
    516
    Just to add, my.cnf on this problematic server appearing to be the same settings as the rest of my 8 server my.cnf, so I assume it wasn't the configuration problems.

    Can someone offer me a help on this matter?

  3. #3
    Join Date
    Jan 2005
    Location
    Scotland, UK
    Posts
    2,681
    Can you paste your my.cnf , maybe they changed it to explictly set the wrong socket.

    The error you are getting is a connection refused on that socket (it does exist), one way to find out what is happening is the first restart when you get the error, login to ssh and ps aux | grep mysql and check if it defines --socket , you can also manually test the socket with

    mysql -S /var/lib/mysql/mysql.sock

    It's more than likely explictly setting the socket at the init.d or in my.cnf
    Server Management - AdminGeekZ.com
    Infrastructure Management, Web Application Performance, mySQL DBA. System Automation.
    WordPress/Magento Performance, Apache to Nginx Conversion, Varnish Implimentation, DDoS Protection, Custom Nginx Modules
    Check our wordpress varnish plugin. Contact us for quote: sales@admingeekz.com

  4. #4
    Join Date
    Apr 2006
    Posts
    516
    OK u're right.

    #ps aux | grep mysql

    I can't see any --socket

    But I can see --socket from another server which is working perfectly.

    # mysql -S /var/lib/mysql/mysql.sock
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 172 to server version: 4.1.21-standard

    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.


    So what exactly is the solution?

  5. #5
    Join Date
    Jan 2005
    Location
    Scotland, UK
    Posts
    2,681
    What does,

    grep "socket" /etc/my.cnf

    Return?
    Server Management - AdminGeekZ.com
    Infrastructure Management, Web Application Performance, mySQL DBA. System Automation.
    WordPress/Magento Performance, Apache to Nginx Conversion, Varnish Implimentation, DDoS Protection, Custom Nginx Modules
    Check our wordpress varnish plugin. Contact us for quote: sales@admingeekz.com

  6. #6
    Join Date
    Apr 2006
    Posts
    516
    This is just all inside my.cnf

    [mysqld]
    set-variable = max_connections=500
    safe-show-database


    My other server has

    [mysqld]
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    skip-locking
    #skip-innodb
    query_cache_limit=1M
    query_cache_size=128M
    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=512M
    join_buffer=1M
    max_allowed_packet=16M
    table_cache=1024
    record_buffer=1M
    sort_buffer_size=4M
    read_buffer_size=4M
    max_connect_errors=10
    thread_concurrency=8
    myisam_sort_buffer_size=64M
    server-id=1

    [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

    [isamchk]
    key_buffer=64M
    sort_buffer=64M
    read_buffer=16M
    write_buffer=16M

    [myisamchk]
    key_buffer=64M
    sort_buffer=64M
    read_buffer=16M
    write_buffer=16M

    [mysqlhotcopy]
    interactive-timeout

  7. #7
    Join Date
    Apr 2006
    Posts
    516
    # grep "socket" /etc/my.cnf
    #

    Nothing on this server

    But on other server:

    # grep "socket" /etc/my.cnf
    socket=/var/lib/mysql/mysql.sock

  8. #8
    Join Date
    Jan 2005
    Location
    Scotland, UK
    Posts
    2,681
    Add socket=/var/lib/mysql/mysql.sock to your my.cnf and then /scripts/restartsrv_mysql
    Server Management - AdminGeekZ.com
    Infrastructure Management, Web Application Performance, mySQL DBA. System Automation.
    WordPress/Magento Performance, Apache to Nginx Conversion, Varnish Implimentation, DDoS Protection, Custom Nginx Modules
    Check our wordpress varnish plugin. Contact us for quote: sales@admingeekz.com

  9. #9
    Join Date
    Apr 2006
    Posts
    516
    I have added the line inside my.cnf which looks like this:
    [mysqld]
    set-variable = max_connections=500
    safe-show-database
    socket=/var/lib/mysql/mysql.sock


    # /scripts/restartsrv_mysql
    Starting MySQL [ OK ]

    Will see if SQL down again in next 5 minutes.. it usually down between 1-10 minutes

  10. #10
    Join Date
    Nov 2004
    Location
    India
    Posts
    1,104
    Well now try this,

    mv /etc/my.cnf /etc/my.cnf.bak

    /scripts/restartsrv mysql
    AssistanZ - Beyond Boundaries...
    Cloudstack Consultancy / 24x7 Web Hosting Support / 24x7 Server Management / Infrastructure Management Services
    Web & Mobile Apps Development / Web Designing Services / Php, Grails, Java Development

  11. #11
    Join Date
    Apr 2006
    Posts
    516
    mv /etc/my.cnf /etc/my.cnf.bak
    /scripts/restartsrv mysql

    The above works. However I have doubts, this means that it will not read my.cnf because there is no my.cnf is that right? Means it won't read configurations... i don't think it can solve this problem permenantly.

  12. #12
    Join Date
    Apr 2006
    Posts
    516
    Now I am facing another server with SQL downtime problem. but it doesn't happen very frequent. Last night SQL was down the whole night while I was sleeping. I had complained to my server management but nothing was done.

    When it was done, I had difficulty restarting mySQL via WHM for the first time. It was only successful at the 2nd attempt

    The my.cnf were standard as follows:

    # cat my.cnf
    [mysqld]
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    skip-locking
    skip-innodb
    query_cache_limit=1M
    query_cache_size=128M
    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=512M
    join_buffer=1M
    max_allowed_packet=16M
    table_cache=1024
    record_buffer=1M
    sort_buffer_size=4M
    read_buffer_size=4M
    max_connect_errors=10
    thread_concurrency=8
    myisam_sort_buffer_size=64M
    server-id=1
    [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
    [isamchk]
    key_buffer=64M
    sort_buffer=64M
    read_buffer=16M
    write_buffer=16M
    [myisamchk]
    key_buffer=64M
    sort_buffer=64M
    read_buffer=16M
    write_buffer=16M
    [mysqlhotcopy]
    interactive-timeout

  13. #13
    Join Date
    Apr 2006
    Posts
    516
    MySQL was down again twice today. Anyone don't mind to help?

  14. #14
    Join Date
    May 2006
    Location
    India
    Posts
    661
    also just make sure there is enough free disk space available in the /var partition...
    SparkSupport.Com - The Premier Tech Company
    Cloud Solutions|Email Infra setup|VOIP|Video Streaming|Software Development
    Email: info@sparksupport.com Phone : 1- 408-600-1449 | Skype : shijils

  15. #15
    Join Date
    May 2006
    Location
    India
    Posts
    661
    Also check the mysql error log /var/log/mysqld.log for any errors at the time of crash.
    SparkSupport.Com - The Premier Tech Company
    Cloud Solutions|Email Infra setup|VOIP|Video Streaming|Software Development
    Email: info@sparksupport.com Phone : 1- 408-600-1449 | Skype : shijils

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •