Z
Z
zdrvstvt2014-10-17 00:35:51
linux
zdrvstvt, 2014-10-17 00:35:51

MySQL has crashed and can't be restarted. What to do to raise MySQL?

There is a server: CentOS 5.4. Intel Celeron Duo 2.0 GHz, HDD: 160GB, RAM: 1GB, CASE: tower.
MySQL crashed on the server and cannot be restarted.
The /etc/init.d/mysqld restart command used to help, but now I can't restart:

bash-3.2# /etc/init.d/mysqld restart
Останавливается mysqld:                                    [  OK  ]
MySQL Daemon failed to start.
Запускается mysqld:                                        [ СБОЙ ]
bash-3.2#

Also the mysql start command does not help:
bash-3.2# mysql start
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
bash-3.2#

I do df -h . The result of the df -h command indicates that the hard disk space has run out.
- Usually, in such a situation, deleting unnecessary files from the file system helps. Accordingly, in this case, I also deleted some files (pictures) to free up space. After that, the free space counter is updated in the interface of the console Midnight Commander - from Midnight Commander it can be seen that ~ 6 GB has been freed:
ca174b7668e74285aa7e40deeceb00e6.png
But at the same time, the result of re-executing the df -h command for some reason still says that there is no space on the hard disk:
6f135389485845beb2ac76f5cf72bdb5.png
And restart MySQL again fails
In /var/lib/mysql in the log file "database.err" writes:
141017  0:20:17 InnoDB: Completed initialization of buffer pool
141017  0:20:17 InnoDB: highest supported file format is Barracuda.
141017  0:20:17  InnoDB: Waiting for the background threads to start
141017  0:20:18 InnoDB: 1.1.8 started; log sequence number 2946898241
./usr/libexec/mysqld: Error writing file '/var/log/mysql-log-slow-queries.log' (Errcode: 28)
141017  0:20:18 [ERROR] Could not use /var/log/mysql-log-slow-queries.log for logging (error 28). Turning logg
ing off for the whole duration of the MySQL server process. To turn it on again: fix the cause, shutdown the M
ySQL server and restart it.
141017  0:20:18 [ERROR] /usr/libexec/mysqld: Error writing file '/var/run/mysqld/mysqld.pid' (Errcode: 28)
141017  0:20:18 [ERROR] Can't start server: can't create PID file: No space left on device
141017 00:20:18 mysqld_safe Number of processes running now: 0
141017 00:20:18 mysqld_safe mysqld restarted
141017  0:20:18 [Note] Plugin 'FEDERATED' is disabled.
141017  0:20:18 InnoDB: The InnoDB memory heap is disabled
141017  0:20:18 InnoDB: Mutexes and rw_locks use GCC atomic builtins
141017  0:20:18 InnoDB: Compressed tables use zlib 1.2.3
141017  0:20:18 InnoDB: Using Linux native AIO
141017  0:20:18 InnoDB: Initializing buffer pool, size = 128.0M
141017  0:20:18 InnoDB: Completed initialization of buffer pool
141017  0:20:18 InnoDB: highest supported file format is Barracuda.
141017  0:20:18  InnoDB: Waiting for the background threads to start
141017  0:20:19 InnoDB: 1.1.8 started; log sequence number 2946898241
./usr/libexec/mysqld: Error writing file '/var/log/mysql-log-slow-queries.log' (Errcode: 28)
141017  0:20:19 [ERROR] Could not use /var/log/mysql-log-slow-queries.log for logging (error 28). Turning logg
ing off for the whole duration of the MySQL server process. To turn it on again: fix the cause, shutdown the M
ySQL server and restart it.
141017  0:20:19 [ERROR] /usr/libexec/mysqld: Error writing file '/var/run/mysqld/mysqld.pid' (Errcode: 28)
141017  0:20:19 [ERROR] Can't start server: can't create PID file: No space left on device
141017 00:20:19 mysqld_safe Number of processes running now: 0
141017 00:20:19 mysqld_safe mysqld restarted
141017  0:20:19 [Note] Plugin 'FEDERATED' is disabled.
141017  0:20:19 InnoDB: The InnoDB memory heap is disabled
141017  0:20:19 InnoDB: Mutexes and rw_locks use GCC atomic builtins
141017  0:20:19 InnoDB: Compressed tables use zlib 1.2.3
141017  0:20:19 InnoDB: Using Linux native AIO
141017  0:20:19 InnoDB: Initializing buffer pool, size = 128.0M
141017  0:20:19 InnoDB: Completed initialization of buffer pool
141017  0:20:19 InnoDB: highest supported file format is Barracuda.
141017  0:20:19  InnoDB: Waiting for the background threads to start

What should I do to restart MySQL? and why, when trying to free up space by deleting files (it always helped before), the df -h command shows that the files seem to have not been deleted (although the folders with these files are empty and Midnight Commander says that the space was successfully freed after deleting the files)
I am attaching a list of log files in the /var/log directory. Tell me which of these logs can be removed (so as not to break anything):
3343a3f78b6245e4b54f69a0f957a2e7.png
Thank you in advance for your assistance in finding a solution.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
G
Glueon, 2014-10-17
@zdrvstvt

I think MC does not show the amount of free space, but how much space was free minus what you removed. So the output of df -h might show the same thing.
Including you could delete files that are currently in use by the system. If you remove the large log file that Apache is using, the actual space will only be freed up when you restart Apache.
Perhaps the pictures were used for something or the handlers got stuck for some reason.
You can also try to do it tune2fs -m 4 /dev/sda1, but I'm not sure if it will work on the working partition.
Try remounting the system mount -o remount,rw /
. You can also remove any log files from /var/log and then restart the appropriate service.

@
@mgyk, 2014-10-17
_

10% space can be reserved for root, but this space is not available for mysql

A
Alexey Solomakha, 2014-10-23
@KamaZz

/dev/sda1 is your screw and there is no space on it.
You apparently deleted the pictures from the mounted / mnt / yandex, which did not make sense at all, because. MySQL is spinning on your disk.
In your scheme, everything that is outside the /mnt directory is your disk, and you need to clean it.
In addition to the logs, I also advise you to pay attention to the /home directory or use the command:
cd / && du -h --max-depth=1

P
polozad, 2015-03-17
@polozad

A typical problem is large logs that are deleted, or rather, the number of hardlinks that have less than one. From the point of view of the system, the file is deleted, in fact, it can be opened for writing / reading and not physically deleted. lsof +L1 will list such files. Well, the way out of this situation is only to restart the service that holds the file.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question