1

I'm running mysql on an Ubuntu server and for some reason, mysql has been shutting down unexpectedly. Usually I can start it back up again, but now it won't start. I don't know what version I'm running, and don't know how to find out. I can't even find any logs for mysql so I have no idea what's going on at all, given that I'm even looking in the right place for logs. I'm really lost here, can someone point me in the right direction?

EDIT:

Ok, after finding out I can look in the syslog for some information, I found this which might be helpful:

Jun 18 12:37:39 ip-10-98-167-102 kernel: [6892262.992944] Out of memory: Kill process 2351 (mysqld) score 95 or sacrifice child
Jun 18 12:37:39 ip-10-98-167-102 kernel: [6892262.992961] Killed process 2351 (mysqld) total-vm:689332kB, anon-rss:57548kB, file-rss:0kB
Jun 18 12:37:39 ip-10-98-167-102 kernel: [6892263.072544] init: mysql main process (2351) killed by KILL signal
Jun 18 12:37:39 ip-10-98-167-102 kernel: [6892263.073876] init: mysql main process ended, respawning
Jun 18 12:37:40 ip-10-98-167-102 kernel: [6892263.872080] type=1400 audit(1340023060.184:20): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=7068 comm="apparmor_parser"
Jun 18 12:37:41 ip-10-98-167-102 kernel: [6892265.330749] init: mysql main process (7072) terminated with status 1
5
  • Try grep log /etc/mysql/my.cnf to find where your logs are. The logs will contain your version. They will also normally contain the reason why it won't start up. Make sure to update your question with as much information as you can find.
    – Ladadadada
    Jun 18, 2012 at 16:23
  • the log file the output gave me doesn't exist. however, after looking in the syslog file, I found out the reason it keeps getting stopped: Out of memory: Kill process 2351 (mysqld) score 95 or sacrifice child i'm going to update the question with the extra info i found Jun 18, 2012 at 16:26
  • Dont try sacrificing child.
    – Sirch
    Jun 18, 2012 at 16:28
  • Sirch: i didn't do anything. it did it all by itself Jun 18, 2012 at 16:29
  • 1
    It seems that your server is running out of memory. The kernel is finding some process which consumes a large amount of memory to kill, to free up some memory for other processes to continue to run. Take a look on what's taking up memory, such as using top. Jun 18, 2012 at 16:39

3 Answers 3

4

That log explains why MySQL died. It was killed by the OOM-killer. The OOM killer is a fun part of Linux that exists because Linux over-promises RAM to processes and then, when they actually want the RAM they've been promised, it kills one of them to give the others the RAM they want.

It chooses which one to kill based on an algorithm that seems to rank MySQL very highly. Probably because it uses a lot of RAM.

I would suggest running mysqltuner.pl (Get it with wget mysqltuner.pl) on your MySQL box and also looking at the output of top to see which processes are using all your memory.

3
  • i'm using root, and when I try to run that script i get this error: bash: ./mysqltuner.pl: Permission denied Jun 18, 2012 at 16:46
  • You have to chmod +x mysqltuner.pl first.
    – Ladadadada
    Jun 18, 2012 at 16:47
  • 1
    that gave me this :*** MySQL's maximum memory usage is dangerously high *** could this also be an issue causing me problems? Jun 18, 2012 at 16:50
0

Ok, I'm so proud of myself for figuring this out since I'm not a linux guru. It turns out that there was a Java processes taking up all the ram (don't know how a java processes got started seeing how i don't use it on that server). This prevented the mysql process from having enough ram to start. I killed the java process and mysql was able to start right up. I guess my real question now is why and how did the java process get started, and is it important?

0

Your server may be out of memory. Have a look at the output of free -t

running top will show you where it is used.

Consider adding more physical memory.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .