Everyone makes mistakes. Just use the Hashnode search and you will find lots of posts about epic fails. Sure, when you break something in production, that's horrible. So in my opinion, there are different phases, and if you act accordingly and professionally, you will gain respect automatically. The phases below are a shortened/reworked version of the 8D problem solving process
This phase is about documenting what went wrong and talking to you boss. If it's a good boss, they will not even ask who caused the problem, but
The last question is more of a "homework". Prepare a few counter-measures. If you deployed bad code to a live-system inadvertently, change the process so that it is not that easy to deploy to that server by accident any more. Add the 4-eyes principle.
Sit together with people involved in fixing the problem and your boss. Present them your solutions for preventing the bug. Show them that you gained experience! Once you reached a conclusion, implement it.
There was a problem, you fixed it, but most importantly, you learned from it. Learning and growing with problems is important, too! No one is perfect and many problems with processes and standards can only be discovered by an incident. What you did was not only a good thing for yourself, but you also made the company a better place for your colleagues, because you (hopefully) found a way to prevent anyone from getting into your situation ever again.
There might even come a time when you tell other people about that emergency over a beer and you will all laugh. I have already heard countless stories of embarrassing mistakes. Hearing those stories tells me about things I have to watch out for and is a fun way to learn more about your colleagues. :)