Adult mammalian injured axons regenerate over short-distance in the peripheral nervous system (PNS) while the axons in the central nervous system (CNS) are unable to regrow after injury. Here, we demonstrated that Lycium barbarum polysaccharides (LBP), purified from Wolfberry, accelerated long-distance axon regeneration after severe peripheral nerve injury (PNI) and optic nerve crush (ONC). LBP not only promoted intrinsic growth capacity of injured neurons and function recovery after severe PNI, but also induced robust retinal ganglion cell (RGC) survival and axon regeneration after ONC. By using LBP gene expression profile signatures to query a Connectivity map database, we identified a Food and Drug Administration (FDA)-approved small-molecule glycopyrrolate, which promoted PNS axon regeneration, RGC survival and sustained CNS axon regeneration, increased neural firing in the superior colliculus, and enhanced visual target re-innervations by regenerating RGC axons leading to a partial restoration of visual function after ONC. Our study provides insights into repurposing of FDA-approved small molecule for nerve repair and function recovery.