Jami` at-Tirmidhi Book 10, Hadith 89
"The Messenger of Allah passed by the graves of Al-Madinah, so he turned his face towards them and said: (As-Salamu alaikum ya ahlul-qubur! Yaghfirul-lahu lana wa lakun, antum salafuna wa nahnu bil-athar.) 'Peace be upon you O inhabitants of the grave! May Allah forgive us and you; you are our predecessors and we are to follow you.'"
"The Messenger of Allah prohibited plastering graves, writing on them, building over them, and treading on them."
The Messenger of Allah said: "I had prohibited you from visiting the graves. But Muhammad was permitted to visit the grave of his mother: so visit them, for they will remind you of the Hereafter."