What is the meaning of [misery loves company]

When you are unhappy, it is good to be with others who have suffered in a similar way, or simply with people who will listen to your woes and offer sympathy; also used to imply that everybody around them to be in the same situation.