District Judge Lucy Hogarth told Connor that the nature and circumstances of the charge meant the case needed to be allocated to the Crown Court.
Connor, of Gorton Road, Stockport, also faced an allegation of possession of cannabis, also on Tuesday, which he admitted.
He was remanded in custody to next appear at Manchester Crown Court on 3 April where both matters will be dealt with.
No application for bail was made by his solicitor.
Earlier, police said a second man who was arrested in connection with the incident will face no further action.
Chairman of the mosque Hamad Khan previously said a man entered the mosque at about 20:30 GMT on Tuesday when around 1,500 people were saying Ramadan prayers.
Khan said the suspect was ushered into an office and police were called after an axe was spotted in his bag.