Unable to Start Site 'Can't connect to local MySQL server through socket'

My only solution for this type of issues is recreating the site and starting from scratch. I didn’t find any workaround. I am looking for other convenient solutions for having local wp sites running as errors shown above became a pretty frequent situation.