Score:0

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

ni flag

Hello I've a major issue here that the server diskspace got full days ago, then all services turned off I managed to clear some space and have 48GB free space, but the issue I face now is that I can't start Apache, MariaDB, and nginx services

Every time I start Apache, MariaDB, or nginx it turns off and I get an error in the email:

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

service mysql restart
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
root/home/admin# systemctl status mysql.service
● mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; disabled; vendor preset>
     Active: failed (Result: exit-code) since Fri 2023-07-21 23:47:07 CEST; 1mi>
    Process: 5983 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=e>

Jul 21 23:47:07 systemd[1]: mysql.service: Scheduled restart job, r>
Jul 21 23:47:07 systemd[1]: Stopped MySQL Community Server.
Jul 21 23:47:07 systemd[1]: mysql.service: Start request repeated t>
Jul 21 23:47:07 systemd[1]: mysql.service: Failed with result 'exit>
Jul 21 23:47:07 systemd[1]: Failed to start MySQL Community Server.

Then I tried

systemctl status mariadb.service

Warning: The unit file, source configuration file or drop-ins of mariadb.servic>
● mariadb.service
     Loaded: masked (Reason: Unit mariadb.service is masked.)
    Drop-In: /etc/systemd/system/mariadb.service.d
             └─migrated-from-my.cnf-settings.conf
     Active: inactive (dead) since Fri 2023-07-21 23:42:42 CEST; 26min ago
   Main PID: 826 (code=exited, status=0/SUCCESS)
     Status: "MariaDB server is down"

Jul 21 23:42:42 mariadbd[826]: 2023-07-21 23:42:42 0 [Note] InnoDB:>
Jul 21 23:42:42 mariadbd[826]: 2023-07-21 23:42:42 0 [Note] InnoDB:>
Jul 21 23:42:42 mariadbd[826]: 2023-07-21 23:42:42 0 [Note] InnoDB:>
Jul 21 23:42:42 mariadbd[826]: 2023-07-21 23:42:42 0 [Note] InnoDB:>
Jul 21 23:42:42 mariadbd[826]: 2023-07-21 23:42:42 0 [Note] InnoDB:>
Jul 21 23:42:42 mariadbd[826]: 2023-07-21 23:42:42 0 [Note] InnoDB:>
Jul 21 23:42:42 mariadbd[826]: 2023-07-21 23:42:42 0 [Note] InnoDB:>
Jul 21 23:42:42 mariadbd[826]: 2023-07-21 23:42:42 0 [Note] /usr/sb>
Jul 21 23:42:42 systemd[1]: mariadb.service: Succeeded.
Jul 21 23:42:42 systemd[1]: Stopped MariaDB 10.5.21 database server.
lines 1-19/19 (END)...skipping...
Warning: The unit file, source configuration file or drop-ins of mariadb.servic>
● mariadb.service
     Loaded: masked (Reason: Unit mariadb.service is masked.)
    Drop-In: /etc/systemd/system/mariadb.service.d
             └─migrated-from-my.cnf-settings.conf
     Active: inactive (dead) since Fri 2023-07-21 23:42:42 CEST; 26min ago
   Main PID: 826 (code=exited, status=0/SUCCESS)
     Status: "MariaDB server is down"

Jul 21 23:42:42 mariadbd[826]: 2023-07-21 23:42:42 0 [Note] InnoDB:>
Jul 21 23:42:42 mariadbd[826]: 2023-07-21 23:42:42 0 [Note] InnoDB:>
Jul 21 23:42:42 mariadbd[826]: 2023-07-21 23:42:42 0 [Note] InnoDB:>
Jul 21 23:42:42 mariadbd[826]: 2023-07-21 23:42:42 0 [Note] InnoDB:>
Jul 21 23:42:42 mariadbd[826]: 2023-07-21 23:42:42 0 [Note] InnoDB:>
Jul 21 23:42:42 mariadbd[826]: 2023-07-21 23:42:42 0 [Note] InnoDB:>
Jul 21 23:42:42 mariadbd[826]: 2023-07-21 23:42:42 0 [Note] InnoDB:>
Jul 21 23:42:42 mariadbd[826]: 2023-07-21 23:42:42 0 [Note] /usr/sb>
Jul 21 23:42:42 systemd[1]: mariadb.service: Succeeded.
Jul 21 23:42:42 systemd[1]: Stopped MariaDB 10.5.21 database server.

nginx :

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: [emerg] open() "/var/log/apache2/domains/domain.com.error.log" failed (2: No such file or directory)
nginx: configuration file /etc/nginx/nginx.conf test failed

I checked the space now

root: df -h
Filesystem Size Used Avail Use% Mounted on
udev 1.9G 0 1.9G 0% /dev
tmpfs 383M 892K 382M 1% /run
/dev/sda1 75G 25G 48G 34% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda15 61M 2.7M 58M 5% /boot/efi
tmpfs 383M 0 383M 0% /run/user/1000

checked the memory too

root# free -h
total used free shared buff/cache available
Mem: 3.7Gi 294Mi 2.5Gi 11Mi 979Mi 3.2Gi
Swap: 0B 0B 0B

I also tried

sudo tail -f /var/log/apache2/error.log
[Sat Jul 22 00:28:29.156692 2023] [mpm_event:notice] [pid 2027:tid 1396530985873 92] AH00492: caught SIGWINCH, shutting down gracefully
[Sat Jul 22 00:29:26.864621 2023] [mpm_event:notice] [pid 4398:tid 1398630996472 32] AH00489: Apache/2.4.57 (Ubuntu) configured – resuming normal operations
[Sat Jul 22 00:29:26.864729 2023] [core:notice] [pid 4398:tid 139863099647232] A H00094: Command line: ‘/usr/sbin/apache2’
[Sat Jul 22 00:29:27.069516 2023] [mpm_event:notice] [pid 4398:tid 1398630996472 32] AH00492: caught SIGWINCH, shutting down gracefully
[Sat Jul 22 00:29:33.810002 2023] [mpm_event:notice] [pid 4946:tid 1401744768053 76] AH00489: Apache/2.4.57 (Ubuntu) configured – resuming normal operations
[Sat Jul 22 00:29:33.810084 2023] [core:notice] [pid 4946:tid 140174476805376] A H00094: Command line: ‘/usr/sbin/apache2’
[Sat Jul 22 00:29:34.229990 2023] [mpm_event:notice] [pid 4946:tid 1401744768053 76] AH00492: caught SIGWINCH, shutting down gracefully
[Sat Jul 22 00:42:05.642805 2023] [mpm_event:notice] [pid 10850:tid 140220855149 824] AH00489: Apache/2.4.57 (Ubuntu) configured – resuming normal operations
[Sat Jul 22 00:42:05.642900 2023] [core:notice] [pid 10850:tid 140220855149824] AH00094: Command line: ‘/usr/sbin/apache2’
[Sat Jul 22 00:42:06.527493 2023] [mpm_event:notice] [pid 10850:tid 140220855149 824] AH00492: caught SIGWINCH, shutting down gracefully

is there anyway to fix this? Thank you in advance

in flag
When you say that you “managed to clear some space”, how did you do that? From the look of the error messages, it seems that some core files have been deleted. The logs in `/var/log/mysql` will be useful to determine what’s wrong with your DB server
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.