Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Sometimes on my VPS I get the error

Warning: mysql_pconnect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) in /var/www/mysql.php on line 8

It can be solved by restarting MySQL several times, restating the sever or sometimes using mysqld command.

Using the mysqld command I get the following:

root@web:~# mysqld
130109 10:47:23 [Note] Plugin 'FEDERATED' is disabled.
130109 10:47:23 InnoDB: The InnoDB memory heap is disabled
130109 10:47:23 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130109 10:47:23 InnoDB: Compressed tables use zlib
130109 10:47:23 InnoDB: Initializing buffer pool, size = 128.0M
130109 10:47:23 InnoDB: Completed initialization of buffer pool
130109 10:47:23 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
130109 10:47:23  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
130109 10:47:24  InnoDB: Waiting for the background threads to start
130109 10:47:25 InnoDB: 1.1.8 started; log sequence number 43428438
130109 10:47:25 [Note] Server hostname (bind-address): ''; port: 3306
130109 10:47:25 [Note]   - '' resolves to '';
130109 10:47:25 [Note] Server socket created on IP: ''.
130109 10:47:25 [Note] Event Scheduler: Loaded 0 events
130109 10:47:25 [Note] mysqld: ready for connections.
Version: '5.5.28-0ubuntu0.12.04.3'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
130109 10:47:25 [ERROR] mysqld: Table './sever/table' is marked as crashed and should be repaired
130109 10:47:25 [ERROR] mysqld: Table './sever/table' is marked as crashed and should be repaired
130109 10:47:25 [ERROR] mysqld: Table './sever/table' is marked as crashed and should be repaired
130109 10:47:25 [Warning] Checking table:   './sever/table'

My get only 50 visitors a day and uses more than 3000 queries per hour. My VPS is only 1 core with 256MB ram and runs on Ubuntu 64bit.

MySQL downtimes directly affect my website and I can't find a answer anywhere.

Thanks in Advance :)

share|improve this question
This looks like the OOM-killer to me. Try this –  Ladadadada Jan 9 '13 at 12:36
add comment

3 Answers 3

You should have a look at the log (mysql error log, mysql query log, system logs) entries when the system is misbehaving not after you restart it.

It's likely that you are reaching the max connections limit.

only 50 visitors a day and uses more than 3000 queries per hour

erk, that's absurdly high, even if you are using Hibernate (but you made no mention of what's in between the webserver and MySQL).

I'd be looking to see what's happenning with the web traffic around this time - is it slowing down - are you swapping out too much stuff - exactly how many users are connected. Also check what's happenning with the mysqld process before you try to restart it - is the process still present?

share|improve this answer
add comment

Check your log, your table is crashing..

You should repair it before you continue. See this link on how to do it

Also check the [hostname].err MySQL error log file. It could be in /var/lib/mysql either /var/log/syslog

share|improve this answer
add comment
up vote 0 down vote accepted

I just upgraded to 512MB of Ram and it stopped. I think it is the OOM-killer mentioned by Ladadadada. you can see a Anseer for the OOM-Killer here.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.