An easy way to get an injection of self-confidence is to attend a "motivational speech" where some guy speaking perfect English without my funny accent shouts at you and tells you how great you are: "You can succeed, you are great, you can do it!" And everybody claps. And we all go home feeling great about ourselves, for three days, maybe. In my experience, however, the only highly sustainable source of self-confidence comes from deep self-knowledge and blatant self-honesty.
In my engineer's mind, I think of it as understanding two important things about myself: my "failure mode" and my "recovery mode." If I can understand a system so thoroughly I know exactly how it fails, I will also know when it won't fail. I can then have strong confidence in the system despite knowing it's not perfect because I know precisely what situations I must keep it away from. In addition, if I also know exactly how the system recovers after failure, I can be confident even in situations where it fails, because I know the conditions where the system can come back quickly enough that nothing major will be affected. Similarly, by understanding those things about my mind, my emotion and my capability, I can gain confidence in myself despite my numerous failings and despite looking like me.
The type of deep self-knowledge and blatant self-honesty needed for sustainable self-confidence means having nothing to hide from ourselves. It comes from accurate self-assessment. If we can assess ourselves accurately, we are able to clearly and objectively see both our greatest strengths and our biggest weaknesses. We become honest to ourselves about our most sacred aspirations and darkest desires. We learn about our deepest priorities in life, what is important to us, and what is *not* important that we can let go of. Eventually, we reach a point where we are comfortable in our own skin. There is no skeleton in our closet that we don't already know about. There is nothing about ourselves we cannot deal with. This is the basis of self-confidence.
Accurate self-assessment in turn comes from strong emotional awareness. I think of it as receiving emotional data at a very high signal-to-noise ratio (i.e. "clean signal"). To strengthen our emotional awareness, we must carefully study our emotional experience. We are like a trainer studying a horse: the more we carefully observe the horse in different situations, the more we understand its tendencies and behaviors, and the more skillfully we can work with it. With that clarity, we create a space that allows us to view our own emotional lives as if seeing it as an objective third party. In other words, we gain objectivity, we begin to perceive each emotional experience clearly and objectively as it is. This is the "clean signal" that creates the conditions for accurate self-awareness.
Finally, strong emotional awareness comes from mindfulness.
That is how mindfulness leads to self-confidence. At least for an engineer.