Passwords are the foundation of the security of your online data, teach your child to use strong passwords from a young age. With young children it is best you know what their password(s) are as well. Teach them how to make strong passwords, and choose some together. Explain to your child that passwords are very personal, and that they should never share them, not even with their best friend.
As your child gets older, he/she needs more trust and privacy. Parents have to respect this privacy but they also have to be the person your child trusts and who teaches them to protect their privacy on the Internet. If you want to monitor what they do on social media, you can use parental controls, but always do this in joint consultation and show your child you trust him/her.