It is narrated from Sayyiduna Mughirah bin Shu’bah (may Allah be pleased with him), he says that when the Prophet (peace and blessings of Allah be upon him) would go to relieve himself, he would go far away (from the people).
Related hadith on this topic