I have asked friend and relations a question and want to publish the answers with their name by the answer. If I ask them if they mind it being publishes is that enough?
If you use other people's stories / anecdotes you have to have their written permission and/or the permission of their parents/guardians if the person is under 18 (or whatever the legal age is in your country). You also need permission to reveal their names - this is a separate issue, some people prefer to remain anonymous, in which case you have to make sure you don't give away their identity/address in your writing.
This is especially important when using minors as sources, because you will not just end up with a lawsuit, you will end up in jail - revealing the identity of a minor or writing about one without permission is a criminal offence in most places.
You can always write about your experiences, including things other people tell you. However, don't try to pass off other people's stories as your own. For example, you could share an anecdote someone told you by describing the experience:
"A few years back, I was sitting on the commuter rail from Boston to Newburyport, when a white-haired woman with a care-worn face sat in the bench opposite from me. She told me this tale of love and heartbreak:
<the beginning of that person's story>"
Be ethical in what you say and how you say it. Remove personally identifying details. Consult a lawyer if you're concerned about libel, defamation, or slander.