2002: Can't connect to local MySQL server through socket
MySQLWhat does it mean?
The client could not connect to the local MySQL server through the Unix socket. Usually the server is not running or the socket path is wrong.
Why does it happen?
The MySQL/MariaDB service is not running or has crashed, the socket file path (e.g. /var/run/mysqld/mysqld.sock) differs between client and server, permission problems, or the server has not started.
How to fix it
Check the service status and start it (systemctl status mysql / start mysql). Verify the correct socket path: SHOW VARIABLES LIKE 'socket' and the socket setting in my.cnf. If the path differs, specify it explicitly with --socket or use TCP: mysql -h 127.0.0.1 -P 3306. Check the server logs for startup/crash errors.