Mysqldump: Got error: 2002 (111 "Connection refused")" when trying to connect

I was getting mysql error while updating an app.

Warning: mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111 "Connection refused")" when trying to connect

Doing
grep mysql /var/log/syslog | tail -50
showed this error in the log:

/etc/mysql/debian-start[15744]: ERROR 1436 (HY000) at line 574: Thread stack overrun: 6320 bytes used of a 131072 byte stack, and 128000 bytes needed. Use 'mysqld --thread_stack=#' to specify a bigger stack.

I did
mysqld --thread_stack=258K
and
/etc/init.d/mysql restart
and everything was normal. Anybody could explain the cause of the problem?

Hm I’m not sure, but that could be some sort of memory leak (or at least memory usage too high) I would guess :confused: