Ive got a mid 2012 mac mini which i have used constantly without issue for about 5 years. Today it seems to have developed a weird fault were it powers off by itself. I powered it back on just after lunch as it was off and when i came back it had turned itself off again.
At first i thought it might be a loose connection with the power cable or extension cord, but i checked them all and they are in tightly with plenty of slack on the cable.
As per suggestion in comments ive opened up the shutdown cause log and it seems to be caused by
localhost kernel[0]: Preview shutdown cause: -62
There are a couple of 5
listings also.