如何修复“MySQL 错误消息为:DBI 连接失败:无法通过套接字 '/var/run/mysqld/mysqld.sock' (2) 连接到本地 MySQL 服务器?”

如何修复“MySQL 错误消息为:DBI 连接失败:无法通过套接字 '/var/run/mysqld/mysqld.sock' (2) 连接到本地 MySQL 服务器?”

我通过提供商 Contabo 升级了我的 VPS,从那时起,我一直遇到问题。不幸的是,他们没有做出回应或提供任何支持。

当我执行命令:service mysql start 时,它返回

The full MySQL error message was : DBI connect failed : Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) ?

命令: sudo systemctl status mysql ,给出:

mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Mon 2023-10-30 03:51:56 CET; 9s ago
    Process: 4936 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)

Oct 30 03:51:56 vmi891613.contaboserver.net systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Oct 30 03:51:56 vmi891613.contaboserver.net systemd[1]: Stopped MySQL Community Server.
Oct 30 03:51:56 vmi891613.contaboserver.net systemd[1]: mysql.service: Start request repeated too quickly.
Oct 30 03:51:56 vmi891613.contaboserver.net systemd[1]: mysql.service: Failed with result 'exit-code'.
Oct 30 03:51:56 vmi891613.contaboserver.net systemd[1]: Failed to start MySQL Community Server.

我尝试重新启动”sudo systemctl 启动 mysql”,但显示:

Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.

systemctl status mysql.service 给出了前面提到的相同内容。如果有人知道如何解决这个问题而不丢失我在 VPS 中的网站,请帮助我,这个 VPN 中有大约 6 个域名,而服务提供商 (Contabo) 没有提供帮助。 48 小时过去了,经济损失随着时间的流逝而不断增加。

相关内容