How to have a relationship
Impossible. When there's relationship, there's bonding. When there's bonding, there's pain when it ends.

The only thing you can do to minimize pain is to stay as independent as possible, and be your own source of joy and acceptance. Which means playing an active role in your life, instead of relying on your partner for initiative and values.