Overnight one of our servers had too many connections. Upon rebooting I now get the following via Plesk:

ERROR: PleskFatalException Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

0: /usr/local/psa/admin/plib/common_func.php3:108 psaerror(string 'Unable to connect to database: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)') 1: /usr/local/psa/admin/auto_prepend/auth.php3:93

When SSHing in, and trying to reboot MySQL I get 'Timeout error occurred trying to start MySQL Daemon'.

Could someone shed some light on this as it's a bit of an emergency. This is a live dedicated server and hasn't been touched in terms of configuration for a long while.

It's a Centos 5.1 install.

Yours, Chris

link|improve this question
1  
You might have more luck with this question on serverfault as it doesn't seem to be directly related to programming – Chris Thompson Sep 14 '09 at 6:07
You need to check your MySQL error logs to see why the server isn't starting. – derobert Sep 14 '09 at 6:16
Thanks, actually looks to be a disk space error: 090914 7:22:44 [ERROR] /usr/libexec/mysqld: Error writing file '/var/run/mysqld/mysqld.pid' (Errcode: 28) 090914 7:22:44 [ERROR] Can't start server: can't create PID file: No space left on device Problem is, I don't what or how to clear something out. – Chris Southam Sep 14 '09 at 6:28
1  
Can you add your 'df -h' output? – Dave Rickman Sep 14 '09 at 7:24
feedback

migrated from stackoverflow.com Sep 14 '09 at 6:22

This question came from our site for professional and enthusiast programmers.

6 Answers

If it's a disk space issue, it may be worth clearing some log files from /var/log to get the server up and running; Longer term, you might want to consider moving the mysql folder to a different drive, or finding some way of shrinking the data bases (maybe by archiving old data). If at all possible, it may be time to look into getting a larger disk for the server.

link|improve this answer
feedback

As has already been said - you need to check the MySQL log files. Clearly MySQL is failing to start. Hopefully there is some sort of useful error in those log files to point you in the right direction. The vast majority of times I've seen this is has been because the partition on which MySQL stores it's raw data is full. By default this would the /var partition.

The default location for the MySQL logs is /var/log/mysqld.log

The following command will show you the status of all your partitions at a glance:

df -h
link|improve this answer
feedback

Also note that InnoDB is a journaling storage engine. This means that you do not recover disk space by deleting records (you actually loose more disk space). So using InnoDB for things that don't need InnoDB (or need not be InnoDB, like a sessions table) will cause you storage (and backup) problems. You can check to see your InnoDB usage with:

SELECT TABLE_SCHEMA, TABLE_NAME, ENGINE FROM information_schema.TABLES WHERE ENGINE = 'InnoDB';
link|improve this answer
feedback

Check the MySQL logfile to see if there's anything interesting:

[user@box dir]# tail /var/log/mysqld.log

link|improve this answer
Thanks, actually looks to be a disk space error: 090914 7:22:44 [ERROR] /usr/libexec/mysqld: Error writing file '/var/run/mysqld/mysqld.pid' (Errcode: 28) 090914 7:22:44 [ERROR] Can't start server: can't create PID file: No space left on device Problem is, I don't what or how to clear something out. – Chris Southam Sep 14 '09 at 6:26
feedback

Quick disk space solution on centos, run yum clean all

link|improve this answer
feedback

Chance are /var/run/mysqld/ doesn't exist. Create it and own it to mysql:mysql and your server should start.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown