Question

MySQL Service is not responding

A few days ago I notice that mysql service is not working, I have tried to restart it, but nothing, it sends an error like:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

but ‘/var/run/mysqld/mysqld.sock’ does not exists.

I also tried:

$ sudo systemctl status mysql.service
● mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2021-04-09 15:02:51 EDT; 14s ago
    Process: 3222 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
    Process: 3230 ExecStart=/usr/sbin/mysqld (code=exited, status=2)
   Main PID: 3230 (code=exited, status=2)
     Status: "Server startup in progress"

Apr 09 15:02:51 ubuntu-s-1vcpu-1gb-sfo2-01 systemd[1]: mysql.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Apr 09 15:02:51 ubuntu-s-1vcpu-1gb-sfo2-01 systemd[1]: mysql.service: Failed with result 'exit-code'.
Apr 09 15:02:51 ubuntu-s-1vcpu-1gb-sfo2-01 systemd[1]: Failed to start MySQL Community Server.
Apr 09 15:02:51 ubuntu-s-1vcpu-1gb-sfo2-01 systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Apr 09 15:02:51 ubuntu-s-1vcpu-1gb-sfo2-01 systemd[1]: Stopped MySQL Community Server.
Apr 09 15:02:51 ubuntu-s-1vcpu-1gb-sfo2-01 systemd[1]: mysql.service: Start request repeated too quickly.
Apr 09 15:02:51 ubuntu-s-1vcpu-1gb-sfo2-01 systemd[1]: mysql.service: Failed with result 'exit-code'.
Apr 09 15:02:51 ubuntu-s-1vcpu-1gb-sfo2-01 systemd[1]: Failed to start MySQL Community Server.

Another thing is that now I have very big files in my data bases, and my disk is 100% full:

$ sudo find / -type f -size +1024M -exec ls -lh {} \;
-rw-r----- 1 mysql mysql 12G Apr  6 16:58 /var/lib/mysql/project_1/wp_options.ibd
-rw-r----- 1 mysql mysql 3.9G Apr  6 15:24 /var/lib/mysql/project_2/wp_options.ibd

I’am new to all of this about systems services and administration, so I don’t know whish steeps follows. I also tried this, but did not work either.

To finish, in /var/log/journal/11a47f9aabdc4fb2bec8c733d6ab3300/ there are files 50M+ of size, can I just delete’em?

Thanks a lot in advance.

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

Hi there,

Indeed if your disk space gets to 100% it is quite possible that MySQL would crash and won’t start after that.

I could suggest clearing some old logs from the /var/log directory. Just so you could have a little bit of space to start MySQL.

Another thing that you might have to do in this case is to upgrade the disk space of your Droplet so that you could have enough disk space for your MySQL data.

Once you have enough disk space, you could run the following MySQL query:

  • First access MySQL:
mysql -u root -p
  • Then optimize the 2 tables:
use project_2;
OPTIMIZE TABLE wp_options;

use project_1;
OPTIMIZE TABLE wp_options;

Note that before running the optimize commands, you would need to have at least the size of the table as available space. Let me know how it goes! Regards, Bobby

Hello @themingisprose

If the server is running out of disk space you can follow Bobby’s suggestion to upgrade the disk space. You can also look for log files that are taking a lot of disk space and try to free some space from the droplet.

You can check the disk space usage using the df -h command and examine the disk space partition usage.

Regards, Alex