The Mahamritryunjaya Mantra was found by Rishi Markandey. It was a secret Mantra, and Rishi Markandey was the only one in the world who knew this Mantra. The Moon was once in trouble, cursed by King Daksh. Rishi Markandey gave the Mahamritryunjay Mantra to Sati, Daksh's daughter, for the Moon. This is how the mantra came into common knowledge.