MySQL server down every so often

February 3, 2015 2.3k views

Hello. I have got droplet with this parameters: 512MB Ram 20GB SSD Disk Amsterdam 2 Ubuntu Ubuntu 12.04.4 x32.

I installed nginx, php5-fpm, mysql. But unfortunatly my bd-server down often. I always need to restart it.

Output error is:

SQL Error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) at /var/ line 72
Array ( [code] => 2002 [message] => Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) [query] => mysql_connect() [context] => /var/www/ line 72 )

I tried to solve this problem many times, but still it does not work well.

help me to find solution, please.

Thank you. best regards.

1 Answer

You are running out of memory and OOM killer is killing mysqld.

  • How is possible if I dont host just simple website maybe with 300 unics per day?

  • Memory does not scale directly with visitor count, do this to confirm:

    dmesg | grep -i 'killed process'
  • This command does not work. - this is screenshot

  • You mistyped the command, it's grep not egrep.

  • It still dosnt work. There is no any reacts.

  • Sorry, still very new to this. Didn't know about egrep. But anyways the command is working fine, it's just there isn't anything for grep to output as it can't find an instance of 'killed process'.

    I guess what mekhron thought would be in there, isn't there.

  • I have some problem to.. This what grep shows me.

    dmesg | grep -i 'killed process'
    [315364.165956] Killed process 14772 (python) total-vm:54140kB, anon-rss:43900kB, file-rss:0kB
    [315384.738243] Killed process 847 (python) total-vm:57852kB, anon-rss:46808kB, file-rss:4kB
    [315419.455953] Killed process 11537 (mysqld) total-vm:331140kB, anon-rss:43048kB, file-rss:0kB
    [315459.106327] Killed process 22173 (python) total-vm:53652kB, anon-rss:38840kB, file-rss:4kB
    [368062.122313] Killed process 27284 (npm) total-vm:171856kB, anon-rss:109840kB, file-rss:0kB
    [368118.516950] Killed process 15364 (python) total-vm:54252kB, anon-rss:44012kB, file-rss:36kB
    [368126.976239] Killed process 25106 (python) total-vm:54184kB, anon-rss:44072kB, file-rss:24kB
    [368145.871190] Killed process 13140 (python) total-vm:53200kB, anon-rss:43088kB, file-rss:0kB
    [368205.273939] Killed process 27346 (python) total-vm:91716kB, anon-rss:80268kB, file-rss:4kB
    [652472.107918] Killed process 13971 (python) total-vm:54080kB, anon-rss:43968kB, file-rss:0kB
    [652477.937412] Killed process 28326 (mysqld) total-vm:331144kB, anon-rss:42596kB, file-rss:0kB
    [671829.206352] Killed process 7838 (python) total-vm:53140kB, anon-rss:43028kB, file-rss:0kB
    [671848.507440] Killed process 13972 (python) total-vm:42368kB, anon-rss:32256kB, file-rss:92kB
    [671876.865803] Killed process 5591 (python) total-vm:41364kB, anon-rss:31252kB, file-rss:0kB
    [671882.679541] Killed process 13958 (python) total-vm:41088kB, anon-rss:30848kB, file-rss:0kB

    Also i have droplet with 512mb RAM, and i extend swap file. But this not help, any time falling... On server works 4 sites. 2 only html/css static site. 1 Django project with sqlite, and 1 with MySQL.

  • The same problem with 512mb RAM 20GB - 1 site (wordpress), 1k-2k unics per day.
    Command result:

Have another answer? Share your knowledge.