Cannot connect to a mysqld socket

I get error 2002. The command mysql -S$socket works all right.

What operating system? Which version of Libre Office? Is this when you try to set up a new database, or is it happening on one that has worked at some time in the past? What, if you can put your finger on it, made “the past” different?