Error code

MySQL 2002

MYSQL2002
Database Error Code· An error code returned by a database server such as PostgreSQL or MySQL.

What it means

Can't connect to local MySQL server through socket — the socket file is missing.

How to fix it

  1. Start the MySQL service with systemctl start mysql or service mysql start.
  2. Verify the socket path in my.cnf matches the path specified in the connection string.
  3. Use TCP/IP (--host=127.0.0.1) instead of a socket connection as a temporary workaround.

Not affiliated with MySQL. Answer summarized from the manufacturer's manual linked above; consult that source for the authoritative procedure.