0

Everytime I turn apache2 or mariadb services I get: Can't connect to MySQL localhost ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2) And turnes off

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.

A fix that can make ubuntu server turn on this services normally

  • Does [this info](https://stackoverflow.com/a/15039113/7644018) help? – Paul T. Jul 20 '23 at 01:39
  • 1
    looks like a) mariadb has a different socket configured or b) (more likely) its not started. `systemctl start mariadb.service`. Then `systemctl show mariadb.service` to see if its started. – danblack Jul 20 '23 at 05:06
  • 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. – Spong my bob Jul 21 '23 at 21:47
  • I saw the link before and tried it but it didn't help because I can't start the service of Apache2, MariaDB. it gives me an error. I updated the question – Spong my bob Jul 21 '23 at 21:56
  • `maraidb !== mysql`. Your question asks about MariaDB but your code only shows mysql feedback. That would be a core reason why it's not operating. – Martin Jul 21 '23 at 21:58

0 Answers0