The 2002 is different from the 1045: here the application never reached the database server. No password was refused, because no conversation ever took place. The commonest forms are Can't connect to local MySQL server through socket '...' (2), Connection refused and Connection timed out. What decides the cure is the address the application tried to connect to.
Reading the message
| The message |
What it usually is |
| through socket ... (2) |
A connection to the local server through a file (a socket). Either the service is not running, or the socket path is not what the application expects. |
| Connection refused |
It reached the machine, but nothing listens on that port: the service is stopped, or the port is wrong. |
| Connection timed out |
The request got lost on the way. From outside a shared hosting server, ports 3306 and 5432 are not open, so this is the normal result of connecting from outside. |
| getaddrinfo failed / Name or service not known |
The server name does not exist or has a typo. The host was written wrongly. |
On a hosting account, in order
| 2 |
Try phpMyAdmin. If it opens and you can see the tables, the database is alive and the fault is the application’s. If phpMyAdmin does not open either, and other sites on the account fail at the same time, the service is down on our side: touch nothing and open a ticket.
|
|
On a VPS with your own database server
On a VPS the database server is yours, and the 2002 nearly always means the service is not running. Check its state with systemctl status mariadb (on some installations the service is called mysql). If it stopped, the usual reasons are a full disk and a lack of memory, which the system settles by killing the biggest process; the log journalctl -u mariadb tells you what happened. If the service is running and the error talks about a socket, the path PHP looks for may be a different one: localhost connects through the socket and 127.0.0.1 connects through the port, and trying the second unblocks many cases.
|
Connections that fail “without an error” are nearly always a closed port, not a password. See which ports are open.
|
|
Checked the host and phpMyAdmin still opens, but the site will not connect? Tell us the site address and the exact message.
Open a support ticket
|
RECOMMENDED PRODUCT Web hosting with cPanel Domain and SSL included, daily backups and the panel you already know. from 5.940,00 Kz/mo (3-year plan, with coupon) See plans |