Image

Knowledge base → Reason mysql connect error no such file or directory

[Virtual servers]
Date of publication: 17.10.2023

Error connecting to database:

mysql connect error [localhost]: (2002) no such file or directory (400)

A common reason is running out of space on the SSD disk of the virtual server.

1. Check availability

df -h

2. Solution

If the reason is confirmed, you need to start the service as quickly as possible, but since there is no space, you need to free up some space.

In the /var/log directory, search for the largest log files with the command:

cd /var/log
du -h

...
570M	./journal/35e0ntc6fcds4e4d856be41m17146434
570M	./journal
160M	./apache2
121M	./nginx
851M	.

You will see which folder takes up how much space; in most cases, deleting archived log files will help free up space for running the database.

You can also delete unnecessary backups, if any are configured on your server.

service mariadb restart

For the service to start successfully, it is advisable to free up at least 500 megabytes, but this depends on the size of the databases themselves.





No Comments Yet