What worked was the number of times I exposed myself to be in these situations. I learned that the shy/awkward/insecure vibe I'm putting out made it difficult for the other party to be at ease too. I set myself up for failure simply by being the (shy) "me".
What worked for me (in hindsight) is exposing myself to such situations on purpose. I took every opportunity for a (spontaneous) conversation life offered. You could try something like "rejection therapy" (I did this very late and had a lot of fun discovering the areas I still had lots of work to do): https://en.wikipedia.org/wiki/Rejection_Therapy
Also what helped me was a few books about loving myself before expecting love from others (e.g. love is also "believing in"): https://en.wikipedia.org/wiki/M._Scott_Peck#The_Road_Less_Tr...