Wednesday, 1 May 2013

Troubleshooting MySQL job failed to start


MySQL start fails

$ sudo service mysql start
start: Job failed to start

Troubleshoot

  1. Try to find out what is wrong.
     
    • Start mysqld manually in verbose mode

      $ sudo mysqld --verbose --user=root

    • Check dmesg

      $ dmesg


  2. Mysqld start manually (Step1) without any error, however,  `sudo service mysql start` still fails. Check following settings are proper  in your /etc/mysql/my.cnf; 

    # The MySQL server
    [mysqld]
    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
    lc-messages-dir = /usr/share/mysql



MySQL crashes under heavy load on Webserver.

 Simulate heavy traffic

 $ ab -n 1000 -c 100 http://yourdomainname/

         ab : Apache HTTP server benchmarking tool
         -n number of requests
         -c concurrent requests

 General cause

  1. Generally mysql crashes because it runs out of memory.

  2. There could be other reasons also. Execute dmesg or look at mysql logs. Path for MySQL logs are specified in mysql.cnf.

No comments:

Post a Comment