MySQL Error 2002 (HY000): Can’t connect to local MySQL server through socket
mysqld service is stopped or socket path differs from client default.
Runs locally in browser
Free · No login
Independently Verified 2026-11-25
v4.0.0
Identifier: MySQL Error 2002 (HY000): Can’t connect to local MySQL server through socket
Platform: MySQL / MariaDB
Interactive Diagnostic Checklist
Safe Diagnostic Command:
systemctl status mysql && ls -la /var/run/mysqld/
Technical Explanation
mysqld service is stopped or socket path differs from client default. Verified technical resolution: Start mysql service or connect explicitly over TCP (`-h 127.0.0.1`).
Worked Examples
- Diagnostic check: systemctl status mysql && ls -la /var/run/mysqld/
Limitations & Assumptions
- Confirm exact software version and execution layer before applying configuration changes in production.
Source References & Verification
Resource ID: err-mysql-2002-socket-not-found · Independently verified: 2026-11-25