python
system_error
ai_generated
true
Django数据库操作错误:(2002, "无法通过套接字'/var/run/mysqld/mysqld.sock'连接到本地MySQL服务器(2)")
django.db.utils.OperationalError: (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")
ID: python/django-db-connection-error
80%修复率
86%置信度
0证据数
2024-12-01首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.x | active | — | — | — |
根因分析
MySQL服务器未运行或套接字路径不正确。
English
MySQL server is not running or socket path is incorrect.
解决方案
-
85% 成功率
Start MySQL service: sudo systemctl start mysql
无效尝试
常见但无效的做法:
-
40% 失败
May still fail if MySQL is not running.
-
30% 失败
Doesn't fix the database server issue.