Results 1 to 14 of 14
  1. #1
    Join Date
    Jun 2009
    Posts
    308

    mysql keeps crashing

    Today on a server of mine mysql keeps crashing and I need to manually restart it over and over, the load as well keeps spiking quite high until I stop mysql for a few minutes. There isn't a extra load of traffic or anything as I have the same amount of users on several other servers doing more then this one.

    How do I tell exactly whats happening from then how would I go about fixing it? Basically it mysql crashes and needs to just be manually restarted via ssh.

  2. #2
    Join Date
    Jan 2003
    Location
    U.S.A.
    Posts
    3,911
    It could be a few things and what do the logs show?

  3. #3
    Join Date
    Jun 2009
    Posts
    308
    Quote Originally Posted by Matt - HostPenguin View Post
    It could be a few things and what do the logs show?
    How do I get to the mysql logs?

  4. #4
    Join Date
    Jan 2003
    Location
    U.S.A.
    Posts
    3,911
    Do you see anything about logging in your /etc/my.cnf file? It will tell you in that file if you have it currently turned on. I should of also added to check here /var/lib/mysql/hostname.err .
    Last edited by @Matt; 11-02-2009 at 04:20 PM.

  5. #5
    Quote Originally Posted by Bluz View Post
    How do I get to the mysql logs?
    Please specify your OS flavor: *BSD, Linux, other. Also, as for Linux, the distribution: Debian, CentOS, RedHat, SuSE, ......

    you can take a look at my.cnf, but that file can be located on different places, depending on the distribution.

    In my case (debian) it is in /etc/mysql/my.cnf , and there you should be able to tell where the logs are. If all the log entries are commented out, it worth looking at /var/log and start browsing (in almost all unix flavors, logs are stored there).

    I hope this helps,

    Ildefonso Camargo

  6. #6
    Join Date
    Jun 2009
    Posts
    308
    im on debian, nothing is in the logs right now except the start i just did, when it happens again ill post.

  7. #7
    Join Date
    Jan 2003
    Location
    U.S.A.
    Posts
    3,911
    Most likely it just needs to be optimized.

  8. #8
    Quote Originally Posted by Bluz View Post
    im on debian, nothing is in the logs right now except the start i just did, when it happens again ill post.
    Try to enable slow queries logging, it is disabled by default on debian:

    # Here you can see queries with especially long duration
    #log_slow_queries = /var/log/mysql/mysql-slow.log
    #long_query_time = 2

    these lines are around line 76 on my server (Debian Lenny), you just have to uncomment the "log_slow_queries" and "long_query_time", and see if something is logged in /var/log/mysql/mysql-slow.log

    Also, have you (or somebody else) modified the configuration from its defaults? if yes, you better take a good look at the my.cnf.

  9. #9
    Join Date
    May 2008
    Posts
    340
    Is this a VPS or a dedicated server ? How much memory is available in the server ?

    free -mt
    df -h
    Provide the output of the commands above.
    Twitter : http://twitter.com/eth1networks
    Contact Us : support[at]eth1.in

  10. #10
    Join Date
    Apr 2009
    Posts
    839
    Enter following in the console:

    mysqladmin -u root -p pr

    Then type your root pass

  11. #11
    Join Date
    Oct 2009
    Location
    India
    Posts
    23
    Execute the following command, it will display the mysql process list.

    [email protected] [/]# mysqladmin proc

  12. #12
    Join Date
    Jun 2009
    Posts
    308
    Quote Originally Posted by eth1 View Post
    Is this a VPS or a dedicated server ? How much memory is available in the server ?





    Provide the output of the commands above.
    Code:
    root:~# free -mt
                 total       used       free     shared    buffers     cached
    Mem:           967        955         12          0          0         40
    -/+ buffers/cache:        914         53
    Swap:          509        509          0
    Total:        1477       1465         12
    root:~# df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/sda1             9.7G  946M  8.3G  11% /
    tmpfs                 484M     0  484M   0% /lib/init/rw
    udev                   10M   28K   10M   1% /dev
    tmpfs                 484M     0  484M   0% /dev/shm
    /dev/sda2             220G  156G   53G  75% /home

    Quote Originally Posted by Matt - HostPenguin View Post
    Most likely it just needs to be optimized.
    I've seen a couple scripts for this along time ago, can you lead me to one or atleast a guide?

  13. #13
    Quote Originally Posted by Bluz View Post
    Code:
    root:~# free -mt
                 total       used       free     shared    buffers     cached
    Mem:           967        955         12          0          0         40
    -/+ buffers/cache:        914         53
    Swap:          509        509          0
    Total:        1477       1465         12
    root:~# df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/sda1             9.7G  946M  8.3G  11% /
    tmpfs                 484M     0  484M   0% /lib/init/rw
    udev                   10M   28K   10M   1% /dev
    tmpfs                 484M     0  484M   0% /dev/shm
    /dev/sda2             220G  156G   53G  75% /home


    I've seen a couple scripts for this along time ago, can you lead me to one or atleast a guide?
    Wow, that server has eaten *all* of its ram. That explains why your mysql is crashing so much.

    You *need* to find out why:

    1. Run top and the press the "M" key (uppercase M), that will sort the processes by their memory usage, see which are the first one.

    After running top and pressing M, wait 7 seconds, and then paste the output here (first 10 lines only).

    I hope this helps,

    Ildefonso Camargo

  14. #14
    Join Date
    Jun 2009
    Posts
    308
    Quote Originally Posted by soulhunter View Post
    Wow, that server has eaten *all* of its ram. That explains why your mysql is crashing so much.

    You *need* to find out why:

    1. Run top and the press the "M" key (uppercase M), that will sort the processes by their memory usage, see which are the first one.

    After running top and pressing M, wait 7 seconds, and then paste the output here (first 10 lines only).

    I hope this helps,

    Ildefonso Camargo
    A friend helped me out with this, it seemed like to many mysql connections. It's the type of script that I'm running that eats the ram up though, I have it running on about 20+ servers and only a couple were having this issue. All have the same specs as well.

Similar Threads

  1. New server crashing after some minutes - Mysql ?
    By ZaxiHosting in forum Hosting Security and Technology
    Replies: 11
    Last Post: 01-01-2008, 07:53 PM
  2. MySQL table .MYI file keeps crashing/getting corrupted
    By Kadence in forum Hosting Security and Technology
    Replies: 4
    Last Post: 03-15-2006, 04:51 PM
  3. MySQL crashing
    By frederic in forum Dedicated Server
    Replies: 12
    Last Post: 10-01-2005, 03:38 PM
  4. Mysql and server load and crashing
    By freemancryin in forum Hosting Security and Technology
    Replies: 4
    Last Post: 06-16-2005, 11:55 PM
  5. Mysql server is crashing everying 5-10 min ..
    By theloophole in forum Hosting Security and Technology
    Replies: 0
    Last Post: 08-09-2004, 07:01 PM

Posting Permissions

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