0

I am unsure what happened to my MySQL database. I woke up and found that it's down and I tried restarting it but I get this error message: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111). I google'd a bit and it said to check my df and this is what I got:

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/xvda1             5905972   5905924         0 100% /
tmpfs                   269560         0    269560   0% /lib/init/rw
udev                     10240       480      9760   5% /dev
tmpfs                   269560         4    269556   1% /dev/shm

What does this mean? How do I approach this? How can I address the issue?

Strawberry
  • 1,132
  • 4
  • 15
  • 27

1 Answers1

6

You're at 100% disk usage; MySQL won't be able to start because it will not be able to write data to any files or logs.

Based on your device name, I'm guessing you're using AWS EBS.

If that's the case, you can create a new EBS volume, mount it to the server, copy the data from MySQL's datadir to the new volume and change the my.cnf file to use that location instead.

Regardless you're going to have to clean up some space in general for your OS to function normally as well.

thinice
  • 4,716
  • 21
  • 38
  • How do I know what is taking up most of the space? What's the best way to clean up my space? How can I check my database size? – Strawberry Jan 22 '12 at 19:35
  • 1
    I use http://dev.yorhel.nl/ncdu in order to find what is using the space, it scans the file system and then sorts folders by size so you can drill down to find the culprit. Although you'll need some space in order to install it. – Phil Jan 22 '12 at 19:38
  • Use the search here on serverfault - There's an abundance of scripts that should allow you to get a drill down on what files consume the most. Starting with your MySQL data dir may be a good start. To check your mysql data dir size, you'd do something like `du -hs /var/lib/mysql` (This includes innodb and binary log files however) – thinice Jan 22 '12 at 19:46
  • Logs are a common culprit. Have a look in `/var/log` while you're waiting for one of the above scripts to do its work. – Ladadadada Jan 22 '12 at 19:49