After the coronation of Ugrasen, the scared-thread ceremony of Shri Krishna was performed and it was decided to send him to the ashram of sage Sandipani.
In those days ashrams were not like today's hostels or boardings. There was a touch of divinity; besides formal education it also taught a sense of duty, co-operation and self-restraint. The life of the preceptor or the sage was a living example of selflessness to the students.
Shri Krishna attained all virtues of a perfect youth. While bidding Good-bye, Sandipani told Shri Krishna ' your studies are over, in reality, there is no end of it 'Sandipani was not a merely teacher. He was a genuine preceptor, who led the life ?
When Krishna was leaving the ashram, he asked Gurujee that he had received a lot from the Ashram so what could he offer in Guru-Daxina.
Sandipani didn't reply but students asked Krishna to bring back his son who was kidnapped by demon Panchjanya.
Shri Krishna went by himself to fight with Panchajanya. He tried a great deal to persuade him to return but he didn't agree. When Panchajanya did not accede to the persuasions of Shri Krishna, Shri Krishna killed him and Dutta the son of Sandipani was freed. Panchajanya's bones were grounded into powder out of which a conch was prepared. Shri Krishna named that conch as Panchajanya. From the day onwards, Krishna carried the conch with him.
Krishna was a great friend and he always maintained the relations. Sudama, a Brahmin was Shri Krishna’s great friend. They were classmates at the ashram of Sandipani. Sudama was a poor Brahmin. His wife was a pious soul. She told Sudama that Shri Krishna was a King of Dwarika and his friend also. He would help. Sudama was not interested in wealth, but he wanted to have Shri Krishna’s darshana. So he left for Dwarika with some present. When Sudama reached Shri Krishna’s palace, he was not allowed to go in. Shri Krishna was informed that one poor man, Sudama, wanted to see him as a friend. Shri Krishna jumped from his bed and rushed to see Sudama. He welcomed Sudama with all his heart and love. Rukmani also treated Sudama with all courtesy. Though Sudama was hesitant about the present he had brought, Shri Krishna snatched it from him. Shri Krishna bestowed all the wealth on him. That was the Shri Krishna’s spirit of friendship.
Back to Mathura:
Shri Krishna left the Sandipani ashram and went to Mathura. The residents of Matura were anxiously waiting for Shri Krishna's return. They deeply loved and respected Shri Krishna. Nand had not forgotten that he had declined the kingdom of Mathura in favor of Ugrasen without hesitation. Then Krishna decided to instill the spirit of self-respect and self-reliance in the common people of the republic. He organized public meetings and delivered inspiring speeches. He explained to the people that they should never bow down to the brutish power.
Due to all these people began to think that they were born to achieve something. They became conscious that they were not created merely to live and die like a forest flower.
On other side, the two daughters of Jarasangha Asti and Prapti had become widows with the death of Kansa.Jarasangha was highly enraged and decided to destroy Krishna. Dethroning and killing Kansa by a common citizen like Shri Krishna was not liked by many kings of that time; hence they joined hands with Jarasangha in his camp opposite to Shri Krishna.
Jarasangha, King of Magadh invaded Mathura along with other kings. A mighty army of twenty-three Akshohini of all these kings was collected to attack Mathura. According to Bhagavata, an army consisting of twenty- three Akshohini had attached Mathura on this occasion. An army of one Akshohini is 21,870 chariots, same number of elephants, 65,849 mounted horsemen, and an infantry of 1,05,500.He attacked Mathura for seventeen times.