Lately it has happened that a database in MySQL has been failing. The error that comes out is this:
error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'
I have looked for solutions in other places and they all talk about how to solve the specific problem but none explains the origin of the error and why sometimes it goes out in a way that seems to be random.
So my question is:
What does this error mean? and What does it mean that it only comes out sometimes?
I know that restarting MySQL is solved but I do not want to be doing that forever.
Information that can help:
- Ubuntu 14.04
- MySQL 5.5.46
- I'm using Prestashop
Disk space:
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 30G 4.5G 24G 16% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 487M 4.0K 487M 1% /dev
tmpfs 100M 340K 100M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 498M 0 498M 0% /run/shm
none 100M 0 100M 0% /run/user
Maximum number of connections
$ mysql> SHOW VARIABLES;
...
max_connections 151
And as you can see, the active users do not exceed 20 at the same time.