1

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

  • You need to check your MySQL error logs to see why the server isn't starting. – derobert Sep 14 '09 at 06: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. –  Sep 14 '09 at 06:28
  • 1
    Can you add your 'df -h' output? – David Rickman Sep 14 '09 at 07:24

6 Answers6

2

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.

Rowland Shaw
  • 494
  • 1
  • 9
  • 19
2

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
Bart B
  • 3,457
  • 6
  • 31
  • 42
2

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';
Bruno Bronosky
  • 4,529
  • 3
  • 26
  • 34
1

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

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

Ian Kemp
  • 119
  • 10
  • 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. –  Sep 14 '09 at 06:26
0

Quick disk space solution on centos, run yum clean all

Tom O'Connor
  • 27,480
  • 10
  • 73
  • 148
0

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

kashani
  • 3,922
  • 19
  • 18