Diabetes is associated with higher prevalence of cognitive dysfunction, while the underlying mechanism is still elusive. In this study, we aim to explore the potential mechanism of diabetes-induced cognitive dysfunction and assess the therapeutic effects of Gastrodin on cognitive dysfunction. Diabetes was induced by a single injection of streptozotocin. The Morris Water Maze Test was employed to assess the functions of spatial learning and memory. Transcriptome was used to identify the potential factors involved. Western blot and immunofluorescence were applied to detect the protein expression. Our results have shown that spatial learning was impaired in diabetic rats, coupled with damaged hippocampal pyramidal neurons. Gastrodin intervention ameliorated the spatial learning impairments and neuronal damages. Transcriptomics analysis identified differential expression genes critical for diabetes-induced hippocampal damage and Gastrodin treatment, which were further confirmed by qPCR and western blot. Moreover, p21 activated kinase 2 (PAK2) was found to be important for diabetes-induced hippocampal injury and its inhibitor could promote the survival of primary hippocampal neurons. It suggested that PAK2 pathway may be involved in cognitive dysfunction in diabetes and could be a therapeutic target for Gastrodin intervention.