![如何修复“MySQL 错误消息为:DBI 连接失败:无法通过套接字 '/var/run/mysqld/mysqld.sock' (2) 连接到本地 MySQL 服务器?”](https://linux22.com/image/226008/%E5%A6%82%E4%BD%95%E4%BF%AE%E5%A4%8D%E2%80%9CMySQL%20%E9%94%99%E8%AF%AF%E6%B6%88%E6%81%AF%E4%B8%BA%EF%BC%9ADBI%20%E8%BF%9E%E6%8E%A5%E5%A4%B1%E8%B4%A5%EF%BC%9A%E6%97%A0%E6%B3%95%E9%80%9A%E8%BF%87%E5%A5%97%E6%8E%A5%E5%AD%97%20'%2Fvar%2Frun%2Fmysqld%2Fmysqld.sock'%20(2)%20%E8%BF%9E%E6%8E%A5%E5%88%B0%E6%9C%AC%E5%9C%B0%20MySQL%20%E6%9C%8D%E5%8A%A1%E5%99%A8%EF%BC%9F%E2%80%9D.png)
我通过提供商 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 小时过去了,经济损失随着时间的流逝而不断增加。