The crystallization mechanism of the perovskite crystals inside the mesopores of printable mesoscopic perovskite solar cells is demonstrated by in situ grazing-incidence X-ray diffraction. Ionic liquids can universally tune the crystallization process of different perovksites in the mesopores regradless of the precursor solvents, resulting in enhanced efficiency.