The Messenger of Allah ﷺ said, "I had forbidden you from visiting graves, but now visit them. I had forbidden you from keeping the meat of sacrificial animals beyond three days, but now keep as much of it as you wish. I had forbidden you from making nabidh except in a waterskin, but now drink from any container, but do not drink anything intoxicating."
قال رسول الله ﷺ: نهيتكم عن زيارة القبور فزورها، ونهيتكم عن لحوم الأضاحي فوق ثلاث فأمسكوا ما بدا لكم ونهيتكم عن النبيذ إلا في سقاء فاشربوا في الأسقية كلها، ولا تشربوا مسكرا.
Muslim narrated it in the Book of Funerals (977) through several routes from Muhammad bin Fudayl, from Abu Sinan (that is, Darrar bin Mura), from Muharib bin Dithar, from Ibn Burayda, from his father, and he related the hadith.Nasai narrated it (2032) through another route, and in it, "and do not speak indecent words." "Indecent" here means do not say what is improper of speech, for that would contradict the intended purpose, which is remembrance.Tirmidhi narrated it (1054), and in it, with the wording, "Muhammad has been given permission to visit his mother's grave, so visit it, for it reminds one of the Hereafter."Bayhaqi narrated it (4/76) through another route, from Zuhayr, from Zubayd, from Muharib bin Dithar with his chain of transmission, and in it, "We went out with the Messenger of Allah ﷺ on a journey, and we camped at a place, we being with him nearly a thousand riders. He stood and prayed two units of prayer, then turned to face us with his eyes flowing with tears. Umar rose to him, offering his father and mother as ransom for him, and said to him, 'What is the matter, Messenger of Allah?' He said, "I sought permission from my Lord to ask forgiveness for my mother, but He did not give me permission, and I wept for her out of mercy for her from the Fire. I had forbidden you from visiting graves..."" and he went on to relate the hadith.Abu Dawud narrated it (2235) through the route of Muarrif bin Wasil, from Muharib bin Dithar with his chain of transmission, and in it, "I had forbidden you from visiting graves, so visit them, for in visiting them there is a reminder." Muarrif is trustworthy.