How do I energize a 12v relay coil using a 2N2222 bipolar transistor?
This question has probably already been answered 100's of times. But here is maybe the 201'st time.

Use a circuit that looks like this: